You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Phill <ph...@inversebit.com> on 2011/08/10 09:35:57 UTC

Encoding issues with currency symbol in data format

In my XSSFWorkbook  I'm trying to define a data format for British pounds as follows:
moneyCellStyle.setDataFormat(df.getFormat("£#,##0.00"));

In my Excel document the numbers are formatted correctly and the pound sign is present but it is prefixed by an 'Å' character.	 
e.g. ţ1,500.00

Do I need to explicitly need to set an encoding somewhere or should this automatically be handled by POI?
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: Encoding issues with currency symbol in data format

Posted by Phill <ph...@inversebit.com>.
On 10/ago/2011, at 12:53, Nick Burch wrote:

> On Wed, 10 Aug 2011, Phill wrote:
>> In my XSSFWorkbook I'm trying to define a data format for British pounds as follows: moneyCellStyle.setDataFormat(df.getFormat("£#,##0.00"));
>> 
>> In my Excel document the numbers are formatted correctly and the pound sign is present but it is prefixed by an 'Å' character. e.g. Å£1,500.00
> 
> My hunch is that the encoding you're writing the pound sign into your .java file, and the encoding that javac is expecting are different.
> 
> If you can correctly get the pound sign into java as a correct string, all should be fine
> 
> Nick

Thanks for the pointer - that's exactly what it was.
I set the javac encoding to to UTF-8 which is the same as my source files and all ok now.


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


Re: Encoding issues with currency symbol in data format

Posted by Nick Burch <ni...@alfresco.com>.
On Wed, 10 Aug 2011, Phill wrote:
> In my XSSFWorkbook I'm trying to define a data format for British pounds 
> as follows: moneyCellStyle.setDataFormat(df.getFormat("£#,##0.00"));
>
> In my Excel document the numbers are formatted correctly and the pound 
> sign is present but it is prefixed by an 'Å' character. e.g. Å£1,500.00

My hunch is that the encoding you're writing the pound sign into your 
.java file, and the encoding that javac is expecting are different.

If you can correctly get the pound sign into java as a correct string, all 
should be fine

Nick