Shlomo
Shlomo

Reputation: 3990

How to decode static JSON file with special chars

My static JSON file has content like:

  {
     "language": "de",
     "translations": {
        "language": "Deutsch",
        "checkingPrivileges": "Rechte werden überprüft..."
     }
  }

I am requesting the static file successfully:

// strUrl = '/src/plugins/usermanagement/language/de.json';
Ext.Ajax.request( {
        url: strUrl,
        headers: { 'Content-Type': 'application/json; charset=UTF-8' },
        success: oCallbacks.success,
        failure: oCallbacks.failure,
        scope: this
     } );

And decoding the content:

var oJson = Ext.JSON.decode( oResponse.responseText );

And the result is:

{
  "language": "de",
  "translations": {
     "language": "Deutsch",
     "checkingPrivileges": "Rechte werden �berpr�ft..."
  }

}

My page is <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

I read a couple of posts. So how do I get the umlauts displayed?

Upvotes: 3

Views: 784

Answers (1)

RichieHindle
RichieHindle

Reputation: 281485

Is your static file UTF-8? It looks as though it's actually latin - if so, you should convert it to UTF-8. Since you're on Linux, the iconv command is your friend. :-)

Upvotes: 2

Related Questions