[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform] Encoding issues when initializing a Text Editor

Hi,

I'm having some troubles here, so if anyone can help me out I would really 
appreciate it!

I have an IStorageEditorInput who 'Storage' is an IEncodedStorage.  The 
document of the IStorageEditorInput is being initialized with a Double Byte 
Character Set (DBCS) character (e.g. a russian or japanese character) which 
I have received as a String from elsewhere.
During the Editor initialization the StorageDocumentProvider is being used 
to 'connect' the input (so far so good).

For simplification right now, I've hardcoded the result of 
IEncodedStorage::getCharSet() to return "UTF-16".

The problem though, is when I reach 
StorageDocumentProvider::setDocumentContent(IDocument, InputStream, String 
encoding);
I can see, when debuging, that my InputStream (a DocumentInputStream) has 
the correct text  (looking at the fStore -> fText).  In the debug view, it 
shows 1 character, and it resolves the character properly when showing it in 
the Variables view.

But when the BufferedReader is invoked (line 138 in 
org.eclipse.ui.editors_3.4.0.v20080603-2000.jar ) to 'read' in this 
character, all I get is garbage.  I've tried with UTF-8, UTF-16, UTF-16BE, 
UTF-16LE, all of which result in garbage when the stream is actually read 
in.

Anyone have a guess what the issue might be? or can point me somewhere that 
can help me? Or suggest another approach?
Thanks in advance,

Adam