osscameroon/js-generator

Character Encoding issue

FanJups opened this issue · 2 comments

set the charset of bytes java

https://www.google.com/search?q=set+the+charset+of+bytes+java&rlz=1C1FCXM_pt-PTPT1032PT1032&oq=set+the+charset+of+bytes+java&aqs=chrome..69i57j33i160j33i22i29i30.22275j1j7&sourceid=chrome&ie=UTF-8

https://stackoverflow.com/questions/88838/how-to-convert-strings-to-and-from-utf8-byte-arrays-in-java

//Convert from String to byte[]:

String s = "some text here";
byte[] b = s.getBytes(StandardCharsets.UTF_8);

//Convert from byte[] to String:

byte[] b = {(byte) 99, (byte)97, (byte)116};
String s = new String(b, StandardCharsets.US_ASCII);