0

I would like to convert ISO 6937 to unicode in Android.

Is there any functions or classes?

Thanks in advance.

hyde1004
  • 227
  • 1
  • 4
  • 10
  • You search the web to find a third-party library with support for that character set, e.g. [`java ISO 6937`](https://www.google.com/#q=java+ISO+6937) – Andreas Jul 05 '16 at 23:11

1 Answers1

0

It shouldn't be any different in Android than any other Java platform. Converting between character sets is covered by this answer, but pasted here for posterity:

Charset utf8charset = Charset.forName("UTF-8");
Charset iso88591charset = Charset.forName("ISO-8859-1");

ByteBuffer inputBuffer = ByteBuffer.wrap(new byte[]{(byte)0xC3, (byte)0xA2});

// decode UTF-8
CharBuffer data = utf8charset.decode(inputBuffer);

// encode ISO-8559-1
ByteBuffer outputBuffer = iso88591charset.encode(data);
byte[] outputDat

a = outputBuffer.array();

Naturally, that block of code (pasted verbatim) is for ISO-88591 conversion, but the process should be the same between any two Charsets.

It also looks like Java doesn't (by default) have any builtin Charset support for 6937 (that I can find), but there are projects that add it (such as noophq/java-charset).

With both of those things, you should be able to convert between any two Charsets.

(note: I'm not affiliated with anything I linked, it's just the top results of google)

Community
  • 1
  • 1
Knetic
  • 2,099
  • 1
  • 20
  • 34