Forums Register Login

Problems with Unicode characters, when I use this API Rtf.Template

+Pie Number of slices to send: Send
Hi I'm using this API http://rtftemplate.sourceforge.net/#New%20API and it is working very well, but when I finished my project I discover an issue, the writer function what I'm using does not support characters like this à ã é í...
Anyone already had use this API to write RTF documents? How can I resolve this?

The download of this API can be done at this link:
http://sourceforge.net/project/downloading.php?group_id=153424&use_mirror=ufpr&filename=rtftemplate-1.0.1-b14-src.zip&a=77764145

that is a example code:


The RTF Source
Name: $NAME
City: $CITY

The RTF Target after the execution
Name: Maiko Cezar
City: São Paulo

If anyone can help me with this problem, I'll be very grateful, because my project are done but lack resolve this issue, and the time is short to be delivered.


BB

ps: sorry my english.
+Pie Number of slices to send: Send
Sounds like it's an encoding problem (I actually moved this to the Open Source forum too quickly).

OK, you need to make sure that your program writes the files out in the encoding expected (UTf-8 or whatever). Your reader (Notepad or whatever) needs to be able to _read_ those characters as well, you might be legitimately writing out the correct characters but your client reader and/or your OS may not support those characters.

So

1.) Make sure you're using the right method calls to write the encoded string. So check the API to see if you can pass in the correct encoding required.
2.) Make sure RTF supports that encoding (remember its a limited text format compared to say a MS Word doc), I'm pretty sure this should be OK though.
3.) Make sure your OS/Client Reader can read the correct encoding. You can test this by getting your program to write the characters directly to the console and/or IDE console and compare that against what your client reader can see (be aware that your console/IDE console also need to be able to read that encoding).
+Pie Number of slices to send: Send
Hi,

I have one question, how can I be sure to check my SO and applications, if they can read/writer correctly ? I'm using Ubuntu 8.1 and netbeans 6.5, and to open the RTF files, Writer and Kate.

I did one modification in my code to do that. (I guess)


my output
São Paulo
São Paulo

And then I put this (São Paulo) in the rtfTarget, but without successful. The "ISO-8859-1" encode it's the rtf native encode, isn't?

bb
+Pie Number of slices to send: Send
Hi there,

See here for details on RTF character encoding, it looks like its 8-bit ASCII by default with the ability to display unicode extensions. That should help you choose the encoding you need.
+Pie Number of slices to send: Send
Hi,

Thanks for who have tried to help me. I sent a email to Rtf.Template author, and he answer me with the link to the official forum (no have any reference in the official site), http://sourceforge.net/forum/forum.php?forum_id=513003 I have solved my problem with this function


thanks for all.
+Pie Number of slices to send: Send
Interesting! As the wikipedia article suggests, there needed to be a conversion to unicode, glad you were able to solve it!
Hey, sticks and stones baby. And maybe a wee mention of my stuff:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 4372 times.
Similar Threads
JSP problem
Reading source file & writing to target file Vs copying source file to target file?
why does this file copy not work?
RTFTemplate Jar giving "java.lang.UnsupportedClassVersionError: Bad version number in .class file"
[newbie] String.replace()/replaceAll() removed spaces
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 20:28:29.