phpjsonmongodbrestheartwindows-1251

RESTHeart with windows-1251 charset


To get text "back" I use this code (from utf-8 to 1251, then from utf-8 to 1251, then back to utf-8, cause json throws an error if encoding is not utf-8):

$body = iconv('CP1251', 'UTF-8', iconv('UTF-8', 'CP1251//IGNORE', iconv('UTF-8', 'CP1251//IGNORE', $body)));

After this $body object contains normal text, but without some chars (not special, like cyrilic 'И').


Solution

  • you can set the charset for the JVM that executes RESTHeart with the -Dfile.encoding property.

    Try something like:

    java -Dfile.encoding=CP1251 -server -jar restheart.jar conf.yml