poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From MSB <markbrd...@tiscali.co.uk>
Subject Re: AW: AW: how to set character encoding in new doc file
Date Fri, 22 Jan 2010 14:15:55 GMT

Hello Andreas,

I think that Nick is referring to explictly encoding the Strings using the
required/desired character encoding; there are constructors for the
java.lang.String class that do allow you to specify the character encoding
to the bytes you can strip from the String you have read.

Remember that HWPF is still very imature as an API and it could well be that
the sort of thing you are asking for has not yet been included. The best
long term solution may be to join the development team and contribute.

Yours

Mark B


Doppelhofer Andreas wrote:
> 
> I use HWPFDocument(...) to read the document. When i print the string
> (some text in doc) to stdout/stderr
> all characters are displayed correctly, put when i write it to a new doc
> file, all russian characters are
> stored with "?".
> 
> This is ok:
> System.out.println(line);
> 
> This is nok: (after opening with word)
> range.insertAfter(line);
> 
> dops
> 
>> -----Ursprüngliche Nachricht-----
>> Von: Nick Burch [mailto:nick.burch@alfresco.com] 
>> Gesendet: Freitag, 22. Januar 2010 11:20
>> An: POI Users List
>> Betreff: Re: AW: how to set character encoding in new doc file
>> 
>> On Fri, 22 Jan 2010, Doppelhofer Andreas wrote:
>> > Can anybody help me with this problem?
>> 
>> Word (plus excel, powerpoint etc) can store strings as 
>> unicode or non-unicode. POI works only with java unicode 
>> strings, and handles reading and writing the strings to the 
>> appropriate kinds of bytes for you.
>> 
>> Make sure you're correctly passing your strings as unicode 
>> into java, converting the encoding as needed.
>> 
>> Nick
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org For 
>> additional commands, e-mail: user-help@poi.apache.org
>> 
>> 
> 
> -- 
> 
> 
> Salomon Automation GmbH - Friesachstrasse 15 - A-8114 Friesach bei Graz
> Sitz der Gesellschaft: Friesach bei Graz
> UID-NR:ATU28654300 - Firmenbuchnummer: 49324 K
> Firmenbuchgericht: Landesgericht für Zivilrechtssachen Graz
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/how-to-set-character-encoding-in-new-doc-file-tp27225418p27273764.html
Sent from the POI - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Mime
View raw message