Jump to content
Changes to the Jaspersoft community edition download ×

StaticText & TextField use different encoding


ktrinad

Recommended Posts

By: Vlad Movsikov - movsikov

StaticText & TextField use different encoding

2003-02-20 00:02

When I try to enter russin symbols (windows Cp1251) in StaticText everything fine. But in TextField I get symbols in wrong encoding (windows cp1252 I suppose). Is there any settings for default encoding?

 

 

 

 

By: Giulio Toffoli - gt78

RE: StaticText & TextField use different encoding

2003-02-20 04:50

 

StaticText and textfield are managed by jasperreport in different manner. The first is text that is compiled as is in the jasper file, textfield, othervise, is java code, saved and recompiled, so it's fundamental the XML encoding used to save the file.

This is a mail exchange between me and Vyacheslav Pedak, the first russian that has solved this problem. If I remembre right, the XML Encoding was UTF-8. I hope this helps you.

 

Giulio

 

_________________________________________

 

Hello Giulio,

 

 

Something like this:

 

 

<textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" > <reportElement

mode="Transparent"

x="0"

y="10"

width="30"

height="40"

forecolor="#000000"

backcolor="#FFFFFF"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<textElement textAlignment="Center" lineSpacing="Single">

<font fontName="font.ttf" pdfFontName="font.ttf" size="8" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="true" pdfEncoding ="Cp1251" isStrikeThrough="false" />

</textElement>

<textFieldExpression

class="java.lang.String">$P{STR}</textFieldExpression>

</textField>

 

 

Take a look at <font> element

 

Vyacheslav

 

 

Thursday, January 30, 2003, 12:02:55 PM, you wrote:

 

 

> Ciao Vyacheslav

 

 

> How we have solved the problem to view Russian chars in the pdf generated

> document?

 

 

> Thanks

 

> Giulio

 

 

 

 

By: Vlad Movsikov - movsikov

RE: StaticText & TextField use different encoding

2003-02-21 00:02

I am still having symbols in wrone coding.

I tried different coding (UTF-8, windows-1251) but it didn't help.

 

My XML:

 

<?xml version="1.0" encoding="UTF-8" ?>

<!-- Created with iReport - A designer for JasperReports -->

<!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">

 

...

...

 

<reportFont name="Arial" isDefault="false" fontName="Arial" size="10" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="External TTF font" pdfEncoding="Cp1251" isPdfEmbedded="true"/>

<parameter name="contNo" isForPrompting="true" class="java.lang.String"/>

<title>

<band height="178">

<textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" > <reportElement

mode="Transparent"

x="5"

y="4"

width="469"

height="13"

forecolor="#000000"

backcolor="#FFFFFF"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<textElement textAlignment="Center" verticalAlignment="Top" lineSpacing="Single">

<font fontName="ARIAL.TTF" reportFont="Arial" pdfFontName="ARIAL.TTF" size="10" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="true" pdfEncoding ="Cp1251" isStrikeThrough="false" />

</textElement>

<textFieldExpression class="java.lang.String"><![CDATA["Iiia? aiaiai?╨░: " + $P{contNo}]]></textFieldExpression>

</textField>

 

...

...

 

</jasperReport>

 

 

 

 

 

By: Giulio Toffoli - gt78

RE: StaticText & TextField use different encoding

2003-02-21 00:50

Could you send me your XML? You can find my email on iReport About form.

 

Giulio

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...