Search code examples
javaandroidcharacter-encodingcyrilliccp866

Any freeware java library to encode from Unicode to CP866?


I'm trying to print to a device which supports CP866 encoding only.

Unfortunately the device from which I'm printing (an Android device) does not support CP866, resulting in "abc".getBytes("CP866") throwing the UnsupportedEncodingException.

So, I guess, I have to do Unicode to CP866 encoding myself. Is there any freeware java library that does that?


Solution

  • http://msdn.microsoft.com/en-us/goglobal/cc305166 has the list of characters; should no pre-made option work, writing code to iterate through an array translating Unicode characters to bytes suitable for CP866 shouldn't take much time at all.