Encode Text Error for special language chars
General-Purpose PDF Library for Java and .NET
Status: Beta
Brought to you by:
stechio
When I add text through the ShowText() method, Unicode characters like Polish ones cause an exception.
Example:
This Polish text = " INTERPRETACJA DOKONANA BEZ ZNANEJ PŁCI/WIEKU PACJENTA "
causes codes.GetKey(..) in Encode(string Text) to fail on 'Ł'.
/**
<summary>Gets the internal representation of the given text.</summary>
<param name="text">Text to encode.</param>
*/
public byte[] Encode(
string text
)
{
io::MemoryStream encodedStream = new io::MemoryStream();
for(int index = 0, length = text.Length; index < length; index++)
{
int textCode = text[index];
byte[] charCode = codes.GetKey(textCode).Data;
encodedStream.Write(charCode, 0, charCode.Length);
usedCodes.Add(textCode);
}
encodedStream.Close();
return encodedStream.ToArray();
}
Diff:
Please try the latest update:
http://sourceforge.net/p/clown/code/HEAD/tarball?path=/branches/0.1.2-Fix
If the problem persists, please verify whether the font you are using supports Polish characters: in such a case, please send me your font file so I'm able to examine the issue.
thank you
Yes,
now it works perfectly.
Many thanks for your fast reply.
Andrea Falappi
Last edit: Stefano Chizzolini 2015-06-04