1

what is the encoding of String that i get using

Preferences.userRoot().get(key, def)   

on a windows machine? is it UCS-2? or utf-8? or just some cp125*? and what is it on linux and mac?

EDIT:
i looked at this question What is the character encoding of String in Java? I know that java stores Strings as UTF-16, but what about Preferences or cmd arguments? when reading strings from there does it use default platform encoding?

Community
  • 1
  • 1
Asiat
  • 401
  • 1
  • 5
  • 14
  • 2
    Possible duplicate of [What is the character encoding of String in Java?](http://stackoverflow.com/questions/4453269/what-is-the-character-encoding-of-string-in-java) – Michael Welch Dec 22 '15 at 04:00
  • I think you shouldn't care. It's handled by the system automatically. `String` is already decoded for you. What issue are you having with the Preferences API? – markspace Dec 22 '15 at 04:27
  • @markspace , the problem is when i put some Cyrillic characters "by hand" and then try to get them, i get boxes, as it can not decode them correctly i guess. When i put Cyrillic characters using Preferences API they are converted to Unicode code points, so i think the problem is when i get string from preferences it tries to get it as UTF-16? am i right? – Asiat Dec 22 '15 at 05:03
  • I think we'll need to see this "by hand" code. Probably you messed up that part. – markspace Dec 22 '15 at 05:32
  • @markspace, "by hand" i mean without any code, manually, or if for instance i put it there from C# program `Registry.SetValue("HKEY_CURRENT_USER\\Software\\JavaSoft\\Prefs", "someKey", "someString", RegistryValueKind.String);` – Asiat Dec 22 '15 at 05:41

0 Answers0