We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

Load Data Problem for Local file or Server File

Home Forums Puzzles Load Data Problem for Local file or Server File

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #46829
    fsguegl
    Customer

    Hi all,
    the program that I am creating allows to save some parameters and variables in a text file which is the image of a JSOn.
    The problem, as you can see from the attached image, is that the same file if I load it from the server shows the characters correctly; if, on the other hand, I load it from the local (browse), it changes accents and other characters. How can I fix it ??

    thanks !
    Franco

    Attachments:
    You must be logged in to view attached files.
    #46837
    Pascal
    Customer

    Maybe your local file is missing correct encoding information and the webserver is defaulting to utf-8 while your browser loads the local file with an other default encoding? Just guessing… :unsure:

    #46846

    Hi,

    I think you should explicitly add the font for your app. You can use this puzzle for that

    https://www.soft8soft.com/docs/manual/en/puzzles/Initialization.html#load_font

    Chief 3D Verger | LinkedIn | Twitter

    #46862
    fsguegl
    Customer

    Thanks for your answer Yuri and Pascal,

    I have explicitly loaded all the fonts that are used in the application.

    But the strange thing is that the file we are seeing in the two cases is the same. It’s a file that I saved on the server and then downloaded locally.
    When I load the one on the server everything is fine, when I load its twin locally there are problems.

    #46866
    fsguegl
    Customer

    I made a new test

    I chose the file from server (everything ok)
    I saved the file locally and i chose it for data upload (mismatched characters)
    I moved the local file to the server and reloaded it (all ok)

    There is some anomalies in the two ways of loading the file, I think:
    the local one and the one via url.

    #50537
    fsguegl
    Customer

    Upgrade,

    Hi Yuri,

    after some time I return to this problem which remained one of the few before going online with the site (expected end of March).

    I did some more in-depth tests and I am sure that the problem is in the “open file / load data” module.
    I saved the file with an explicit utf8 encoding.
    I checked that the encoding was correct on the saved file.
    The file is correctly loaded if I just “load data” with the url from the server.
    It is converted incorrectly if I load it using “open file / load data” from the PC.
    Is there a way to dictate the type of encoding to be implemented on the “open data” puzzle? Otherwise I will solve by writing a JS routine in place of this puzzle.
    Thank you!

    Franco

    #50542

    Please note that file names are case-sensitive. May be this is the reason for such behavior?

    Chief 3D Verger | LinkedIn | Twitter

    #50549
    fsguegl
    Customer

    I probably expressed myself badly.

    I have attached a zip file to you which contains:

    confronto1.jpg:

    image where you can see the text being entered and the text as it
    appears after reloading it with “open file” puzzle.

    confronto2.jpg
    where you can see how the text looks after loading in the
    inspection where I put 2 “print to console” containing exactly all
    the uploaded file and where you can see that the characters are
    not encoded correctly.

    FILE_SAVED.ETB
    It is the file where all the data is saved and it is the same one
    that was loaded in the example I showed you. You will notice that
    the characters are correct and that the format is UTF8

    Attachments:
    You must be logged in to view attached files.
    #50712
    fsguegl
    Customer

    Hi Yuri,

    did you have some time to look at what I sent you?

    #50995
    fsguegl
    Customer

    Resolved,

    I used JS to write a simple alternative routine to “openfile”, “loaded data” and “send data”; these returned the content with an incorrect charset.

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.