• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Rob Spoor
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Holloway
  • Piet Souris
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Frits Walraven
  • Himai Minh

Cannot Display UTF-8 Encoded Files ?

 
Ranch Hand
Posts: 244
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I need to read and write UTF-8 encoded files, they are in Simplified Chinese
The original Chinese file was created on a Windows10 platform using WordPad
I am running eclipse on Windows7

Both Firefox and MS Word display the original file in Chinese characters correctly.

But I cannot get eclipse to display the characters, nor write to an .rtf (rich text format) file.

At a guess, it is not in UTF-8 format, something about "fcharset134 SimSun" ?!?

Can anyone see what I did wrong???

Here is what eclipse displays:

1 {\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang1033\deflangfe2052{\fonttbl{\f0\fnil\fprq2\fcharset134 SimSun;}}
2 {\*\generator Riched20 6.3.9600}{\*\mmathPr\mnaryLim0\mdispDef1\mwrapIndent1440 }\viewkind4\uc1
3 \pard\nowidctlpar\sa200\sl276\slmult1\b\f0\fs40\lang2052\'ce\'d2\'cf\'eb\'c2\'f2\'d7\'d4\'d0\'d0\'b3\'b5\par
4 \'b5\'d8\'cc\'fa\par
5 \'b8\'df\'cc\'fa\par
6 \'b9\'ab\'b9\'b2\'c6\'fb\'b3\'b5\'d5\'be\'d4\'da\'c4\'c7\'a3\'bf\par
7 \'bc\'fb\'bc\'d2\'c8\'cb\par
8 \par
etc etc

This is the code...

 
Bartender
Posts: 1845
10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
UTF-8 encoded Text files should be fine with the example code you have shown.

Unfortunately, rtf is more than just a UTF-8 encoded text file.
You will need more than the standard java API to deal with rtf.
 
AhFai Chan
Ranch Hand
Posts: 244
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Stefan Evans wrote:UTF-8 encoded Text files should be fine with the example code you have shown.

Unfortunately, rtf is more than just a UTF-8 encoded text file.
You will need more than the standard java API to deal with rtf.



Googled it.

Yes, you are right.

Thanks.
 
Evildoers! Eat my justice! And this tiny ad's justice too!
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic