Convert from encoded unicode String into Java String -


i have string in json data looks this:

#0023sat apr 30 10:46:11 utc 2016#000a[interoperability]interoperability#005c index=unknown (r03)#000a[exif]shutter#005c speed#005c value=1/1999 sec#000a[exif]bits#005c per#005c sample=8 8 8 bits/component/pixel#000a[exif]exposure#005c bias#005c value=0 ev#000a[exif]sub-sec#005c time#005c original=00#000a 

all #xxxx words unicode.

how convert java string?

pattern p = pattern.compile("#([0-9a-fa-f]{4})"); matcher m = p.matcher(s); stringbuffer sb = new stringbuffer(); while (m.find()) {     int c = integer.parseint(m.group(1), 16);     m.appendreplacement(sb, string.valueof((char) c)); } m.appendtail(sb); return sb.tostring(); 

this assumes #xxxx encodes utf-16 unicode code point. unicode code points supercede 16 bit range of #xxxx.


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -