Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » Output encoding
Output encoding [message #797422] Mon, 13 February 2012 08:19 Go to next message
sam va is currently offline sam va
Messages: 120
Registered: July 2011
Senior Member
Hi

How do I set the output encoding for PDF/Excel?
The options class takes outputStream as one of the parameters but not writer. Hence we cannot set the encoding. Is there anyway?

My problem is, SOME of the french characters like euro are not coming properly in the output pdf/excel. my database is windows-1252 charset.

Thanks
Re: Output encoding [message #797626 is a reply to message #797422] Mon, 13 February 2012 13:14 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

Are you setting the locale on your task?

Jason

On 2/13/2012 8:19 AM, sam va wrote:
> Hi
>
> How do I set the output encoding for PDF/Excel?
> The options class takes outputStream as one of the parameters but not
> writer. Hence we cannot set the encoding. Is there anyway?
>
> My problem is, SOME of the french characters like euro are not coming
> properly in the output pdf/excel. my database is windows-1252 charset.
>
> Thanks


Jason Weathersby

BIRT Exchange
Re: Output encoding [message #798217 is a reply to message #797626] Tue, 14 February 2012 06:46 Go to previous messageGo to next message
sam va is currently offline sam va
Messages: 120
Registered: July 2011
Senior Member
I did try setting the locale as well. But still the same issue.
More than the locale it is something to do with the character encoding. The rptdocument is getting created with that character set. when I try to create PDF/Excel there should be an option to set the encoding. Right now there isnt. Pl help me. This is very critical

Thanks
Re: Output encoding [message #798459 is a reply to message #798217] Tue, 14 February 2012 13:19 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

The xls emitter uses UTF-8 encoding. Currently that is hard coded. For
pdf take a look at the fontEncoding tag in the fontsConfig.xml file. I
have attached the one used by 3.7.1 by default.

Jason

n 2/14/2012 6:46 AM, sam va wrote:
> I did try setting the locale as well. But still the same issue.
> More than the locale it is something to do with the character encoding.
> The rptdocument is getting created with that character set. when I try
> to create PDF/Excel there should be an option to set the encoding. Right
> now there isnt. Pl help me. This is very critical
>
> Thanks
>


Jason Weathersby

BIRT Exchange
Re: Output encoding [message #799080 is a reply to message #798459] Wed, 15 February 2012 07:23 Go to previous messageGo to next message
sam va is currently offline sam va
Messages: 120
Registered: July 2011
Senior Member
Our database charset is set to WE8MSWIN1252

Here are the outputs I have from my report

HTML, PDF, EXCEL, CSV

For generation of the report (Run Task), I did set the locale to CANADA_FRENCH

For HTML I use report tag. In that report tag I have set the locale to fr_CA. This works as expected.

For PDF, in the render task, I did set the locale to CANADA_FRENCH. It works as expected.

For Excel, in the render task, I did set the locale to CANADA_FRENCH. But IT DID NOT WORK AS EXPECTED.

For CSV, I didnt use emitter, but from the dataset fetch method, I write into a file directly by getting the data from he resultset. This also DOESNT WORK AS EXPECTED.
Here is the code while I create a file
var w = new OutputStreamWriter(new FileOutputStream(str), "CP1252");

Is there anything I need to specifically for Excel and CSV?

Meanwhile I also found out that the formatting of dates and amounts has changed
For eg a value of 1,00,000.00 is shown as 1.00.000,00.

Basically the actual locale should be US, but should also show french charcters.

Thanks

[Updated on: Wed, 15 February 2012 09:09]

Report message to a moderator

Re: Output encoding [message #799283 is a reply to message #799080] Wed, 15 February 2012 12:40 Go to previous messageGo to next message
sam va is currently offline sam va
Messages: 120
Registered: July 2011
Senior Member
I did try different locales, but still the issue persists. This is more with encoding than locale. Is there anyway I can set a report data encoding.

Also I have read somewhere that, the data from database is read and then converted to unicode. pl confirm
Re: Output encoding [message #799300 is a reply to message #799283] Wed, 15 February 2012 13:05 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

I am not sure this setting is used for your data source but it may be
worth looking at. Select window->preferences->Data Management->SQL
Development->Execution Plan View Options. Look at the export encoding
setting.

Jason

On 2/15/2012 12:40 PM, sam va wrote:
> I did try different locales, but still the issue persists. This is more
> with encoding than locale. Is there anyway I can set a report data
> encoding.
>
> Also I have read somewhere that, the data from database is read and then
> converted to unicode. pl confirm


Jason Weathersby

BIRT Exchange
Re: Output encoding [message #799305 is a reply to message #799300] Wed, 15 February 2012 13:12 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

BTW can you post the excel file that is not generating properly?

Jason

On 2/15/2012 1:05 PM, Jason Weathersby wrote:
> I am not sure this setting is used for your data source but it may be
> worth looking at. Select window->preferences->Data Management->SQL
> Development->Execution Plan View Options. Look at the export encoding
> setting.
>
> Jason
>
> On 2/15/2012 12:40 PM, sam va wrote:
>> I did try different locales, but still the issue persists. This is more
>> with encoding than locale. Is there anyway I can set a report data
>> encoding.
>>
>> Also I have read somewhere that, the data from database is read and then
>> converted to unicode. pl confirm
>


Jason Weathersby

BIRT Exchange
Re: Output encoding [message #800071 is a reply to message #799305] Thu, 16 February 2012 11:47 Go to previous messageGo to next message
sam va is currently offline sam va
Messages: 120
Registered: July 2011
Senior Member
can someone pl tell me what is the encoding of data in memory

I have printed the data to log from the database in onFetch method. For some characters it is showing as ? characters. Also when I try to encode it to any other charset, it is throwing exception. I am using java classes to encode to other charsets.

Any help regd this is appreciated.

Jason, I will post the file

Thanks
Re: Output encoding [message #800217 is a reply to message #800071] Thu, 16 February 2012 15:42 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

Are you writting it out with:
var w = new OutputStreamWriter(new FileOutputStream(str), "CP1252");
from your earlier post? What happens when you write it out like
var w = new OutputStreamWriter(new FileOutputStream(str), "UTF-8");

Jason

On 2/16/2012 11:47 AM, sam va wrote:
> can someone pl tell me what is the encoding of data in memory
>
> I have printed the data to log from the database in onFetch method. For
> some characters it is showing as ? characters. Also when I try to encode
> it to any other charset, it is throwing exception. I am using java
> classes to encode to other charsets.
>
> Any help regd this is appreciated.
> Jason, I will post the file
>
> Thanks


Jason Weathersby

BIRT Exchange
Re: Output encoding [message #802797 is a reply to message #800217] Mon, 20 February 2012 08:07 Go to previous messageGo to next message
sam va is currently offline sam va
Messages: 120
Registered: July 2011
Senior Member
When I write with CP1252, the output contains ? in place of the following 4 characters

Œ Ÿ œ €

we are targeting to get the following characters along with normal ascii characters (all in windows code page 1252)
ÀÂÄÈÉÊËÎÏÔŒÙÛÜŸàâäèéêëîïôœùûüÿÇç«»€

When I write using UTF8, I get the characters to view correctly. But they are not the actual characters in Cp1252. They are equivalent characters in unicode.

For example
The Euro character (€) will encode as the bytes 80 under windows-1252(Cp1252), A4 under ISO-8859-15 and E2 82 AC under UTF-8. Right now in the file from UTF8, I get as "E2 82 AC". But when I write with Cp1252, I get "3F" instead of 80.

My databse character set is correct (Cp1252). But when I try to view the value in onFetch, it is coming as "?".

I have tried various options as listed below, but nothing worked for me.
1) Set the locale to en_CA/fr_CA in run/render tasks. This changed the formatting of dates and did not get the desired output
2) Set the jvm locale -Duser.country=CA -Duser.language=fr/en. Same result as above
3) Set the jvm property -Dfile.encoding=Cp1252. No change.

As of now I am getting the HTML and PDF outputs correctly. But excel and csv is an issue. For Excel, we are using native excel emitter. For CSV, we are using custom code (as I mentioned earlier, opening an file and writing in onFetch).

Jason,
Pl find the excel attached. The boxes are one of those 4 characters.

Thanks
  • Attachment: 8006.xlsx
    (Size: 7.86KB, Downloaded 56 times)

[Updated on: Mon, 20 February 2012 08:12]

Report message to a moderator

Re: Output encoding [message #803312 is a reply to message #802797] Tue, 21 February 2012 02:08 Go to previous messageGo to next message
sam va is currently offline sam va
Messages: 120
Registered: July 2011
Senior Member
while running in local eclipse it is working fine. The characters are displayed correctly. But when I run in weblogic, the characters are not coming correctly. Looks more like a setting on the jvm

Thanks
Re: Output encoding [message #803650 is a reply to message #803312] Tue, 21 February 2012 11:20 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

Run the attached report in the designer and in weblogic and compare the
outputs. BTW if you deploy the viewer to WL does it work correctly?

Jason



On 2/21/2012 2:08 AM, sam va wrote:
> while running in local eclipse it is working fine. The characters are
> displayed correctly. But when I run in weblogic, the characters are not
> coming correctly. Looks more like a setting on the jvm
>
> Thanks


Jason Weathersby

BIRT Exchange
Re: Output encoding [message #804022 is a reply to message #803650] Wed, 22 February 2012 00:08 Go to previous messageGo to next message
sam va is currently offline sam va
Messages: 120
Registered: July 2011
Senior Member
Jason,

Pl find the local and server info.

Thanks
Re: Output encoding [message #804321 is a reply to message #804022] Wed, 22 February 2012 08:30 Go to previous messageGo to next message
sam va is currently offline sam va
Messages: 120
Registered: July 2011
Senior Member
the properties of interest for us are locale and encoding. and seems like they are same

Thanks
Re: Output encoding [message #804389 is a reply to message #804321] Wed, 22 February 2012 10:10 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

Did you try to run the viewer deployed to Web Logic?

Jason

On 2/22/2012 8:30 AM, sam va wrote:
> the properties of interest for us are locale and encoding. and seems
> like they are same
>
> Thanks


Jason Weathersby

BIRT Exchange
Re: Output encoding [message #804833 is a reply to message #804389] Wed, 22 February 2012 22:29 Go to previous messageGo to next message
sam va is currently offline sam va
Messages: 120
Registered: July 2011
Senior Member
yes. I used the default viewer in birt from weblogic. (frameset)

Thanks
Re: Output encoding [message #805172 is a reply to message #804833] Thu, 23 February 2012 07:29 Go to previous messageGo to next message
sam va is currently offline sam va
Messages: 120
Registered: July 2011
Senior Member
I have run out of options and hit a wall... anyone to help me???
Re: Output encoding [message #805430 is a reply to message #805172] Thu, 23 February 2012 14:06 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

If you are getting this error with the default deployed viewer can you
open a bugzilla entry for this?

Jason

n 2/23/2012 7:29 AM, sam va wrote:
> I have run out of options and hit a wall... anyone to help me???


Jason Weathersby

BIRT Exchange
Re: Output encoding [message #810485 is a reply to message #797422] Thu, 01 March 2012 01:36 Go to previous messageGo to next message
sam va is currently offline sam va
Messages: 120
Registered: July 2011
Senior Member
There is no issue with BIRT. The problem is with Oracle's Type-4 JDBC driver.
We upgraded the driver from 10.2.0.2.0 to 10.2.0.5.0 and everything works like a charm

Thanks
Re: Output encoding [message #810856 is a reply to message #810485] Thu, 01 March 2012 11:06 Go to previous message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

Thanks for the update.

Jason


On 3/1/2012 1:36 AM, sam va wrote:
> There is no issue with BIRT. The problem is with Oracle's Type-4 JDBC
> driver.
> We upgraded the driver from 10.2.0.2.0 to 10.2.0.5.0 and everything
> works like a charm
>
> Thanks


Jason Weathersby

BIRT Exchange
Previous Topic:Birt Viewer and Landscape Report
Next Topic:Bookmarks missing from PDF reports
Goto Forum:
  


Current Time: Fri May 24 04:57:57 EDT 2013

Powered by FUDForum. Page generated in 0.02836 seconds