0

I am getting a RTF from server as below:

{\rtf1\ansi\ansicpg1252\fromtext \deff0{\fonttbl
{\f0\fswiss\fcharset0 Arial;}
{\f1\fmodern Courier New;}
{\f2\fnil\fcharset2 Symbol;}
{\f3\fmodern\fcharset0 Courier New;}
{\f4\fswiss\fcharset128 MS Mincho;}}
{\colortbl\red0\green0\blue0;\red0\green0\blue255;}
\uc1\pard\plain\deftab360 \f0\fs20 \htmlrtf{\f4\fs20\htmlrtf0 Test\'88\'d7\'8d\'44\'97\'46try\htmlrtf\f0}\htmlrtf0 \par
}

This RTF conatins Traditional chinese characters. Meaningful part in this RTF is Test\'88\'d7\'8d\'44\'97\'46try. When I try to display this in Android TextView, I can't see chinese characters as text.

on googling I got that chinese characters are encoded in fcharset136 charset.But I am not able to display the chinese part in Android.

Please let me know how to decode this character set.

mjn
  • 36,362
  • 28
  • 176
  • 378
Manish
  • 668
  • 1
  • 9
  • 30
  • 1
    If you give this rtf to wordpad, is all diplayed well? Do you know which characters they represent? How many characters? I think it is a 'microsoft only' coding. – greenapps Jul 11 '14 at 08:44
  • yes, If i put this in a file and open it in Word, every thing is correctly displayed. like this: Test為好友try – Manish Jul 11 '14 at 09:17
  • Maybe you have to do something like this: byte mybytes []= new byte [6]; byte[0] = 0x88; byte[1= 0xd7; byte[2] = 0x8d; and so on..; and then String text = new String(mbytes); textView.setText(text); or something like that. Just try. – greenapps Jul 11 '14 at 09:58
  • Progress report: copied 為好友 from the browser to notepad. When saved as unicode the values were 707d 59cb 5374. Saved as utf-8 got E782BA E5A5BD E58F8B. Thats different from in your rtf. So indeed some charset thing will be involved. – greenapps Jul 11 '14 at 10:17
  • actually i had tried that , and did not got any success. I also changed the encoding to UTF-16 ..but did not got any success – Manish Jul 11 '14 at 10:56
  • It would have been nice if you had told that right from the start. Could bring a solution sooner. Which values do you get with utf-16? `this in Android TextView, I can't see chinese characters as text.` Well what do you see instead? – greenapps Jul 11 '14 at 10:58

0 Answers0