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?

5
  • 2
    Possible duplicate of What is the character encoding of String in Java? Commented Dec 22, 2015 at 4: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? Commented Dec 22, 2015 at 4: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? Commented Dec 22, 2015 at 5:03
  • I think we'll need to see this "by hand" code. Probably you messed up that part. Commented Dec 22, 2015 at 5: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); Commented Dec 22, 2015 at 5:41

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.