1. #1
    Sencha User
    Join Date
    Oct 2013
    Posts
    32
    Answers
    2
    Vote Rating
    0
    Stiijnn is on a distinguished road

      0  

    Default Unanswered: Problem with reading strange/foreign characters from JSON file

    Unanswered: Problem with reading strange/foreign characters from JSON file


    Hi guys,

    I'm having a problem with reading strange/foreign characters from a JSON file. The strange/foreign characters are transformed to a question mark...

    For example:

    vóór (in the JSON file)
    becomes
    voor.png (in the console.log(value) when reading and storing the data in the store)

    I did include the UTF-8 charset in my index.html as follows:
    Code:
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    The data is (currently) stored in a local json file as follows:
    Code:
    [
        {
            "title": "Test",
            "content": "<p>Test me please. Dit zou als vóór moeten verschijnen.</p>"
        }
    ]
    And this is the Panel where it should appear:
    Code:
    Ext.define('Infections.view.illness.Details', {
        extend: 'Ext.Panel',
        xtype: 'illnessDetails',
    
        config: {
            title: 'Content',
            iconCls: 'info',
            tpl: '{content}'
        }
    });
    Any known fixes for this?

    Thanks.

  2. #2
    Sencha User
    Join Date
    Feb 2011
    Location
    Düsseldorf, Germany
    Posts
    572
    Answers
    34
    Vote Rating
    31
    Kurt001 has a spectacular aura about Kurt001 has a spectacular aura about

      0  

    Default


    You might have to send the content in the correct way from the server.
    e.g. PHP
    utf8_encode($returnValue)
    • Kurt001
    Code Review | Send PM


    Need to include a test case use:
    https://fiddle.sencha.com/#home

  3. #3
    Sencha User
    Join Date
    Oct 2013
    Posts
    32
    Answers
    2
    Vote Rating
    0
    Stiijnn is on a distinguished road

      0  

    Default


    The problem is I can't edit to the data on the server side.

  4. #4
    Sencha User
    Join Date
    Feb 2011
    Location
    Düsseldorf, Germany
    Posts
    572
    Answers
    34
    Vote Rating
    31
    Kurt001 has a spectacular aura about Kurt001 has a spectacular aura about

      0  

    Default


    probably something like this helps
    • Kurt001
    Code Review | Send PM


    Need to include a test case use:
    https://fiddle.sencha.com/#home

  5. #5
    Sencha User
    Join Date
    Oct 2013
    Posts
    32
    Answers
    2
    Vote Rating
    0
    Stiijnn is on a distinguished road

      0  

    Default


    I tried your solution but instead of the question mark it is now displayed as:
    v��r

    So the problem is not really in displaying the characters, but rather in reading the characters from the JSON file...

    In the JSON file it says:
    vóór

    but when logging the data in the model (via convert => console.log(value)) it says:
    v��r

  6. #6
    Sencha User
    Join Date
    Oct 2013
    Posts
    32
    Answers
    2
    Vote Rating
    0
    Stiijnn is on a distinguished road

      0  

    Default


    Any other solutions available?

    I'm still stuck on this problem where the strange/foreign characters from my JSON file can not be read, and are replaced by the symbol �.

  7. #7
    Sencha User
    Join Date
    Feb 2011
    Location
    Düsseldorf, Germany
    Posts
    572
    Answers
    34
    Vote Rating
    31
    Kurt001 has a spectacular aura about Kurt001 has a spectacular aura about

      0  

    Default


    There is no one line command to solve this.
    Personally I did a htmlDecode method which takes all special chars and works with str.replace().

    I created an object with the special chars ({"&ugrave;":"ù"}) and then it runs over the text in a for loop.
    • Kurt001
    Code Review | Send PM


    Need to include a test case use:
    https://fiddle.sencha.com/#home

Thread Participants: 1

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..."