Windows-1251 Codes - UTF-8

I have a character code in a Windows-1251 code table. How can I get the code for this character in the UTF-8 code table?

For example, I have the character "A" with 192 encoded in Windows-1251, the corresponding utf-8 code is 1040

How can I initialize a character or char in Java with code 192 from the Windows-1251 code table?

char c = (char) 192; // how to specify the encoding?

+4
source share
1 answer

To convert the byte [] encoding to one character encoding in another, you can do

public static byte[] convertEncoding(byte[] bytes, String from, String to) { return new String(bytes, from).getBytes(to); } 
+7
source

Source: https://habr.com/ru/post/1387704/


All Articles