• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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).
 
Maiko Cezar
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Martijn Verburg
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Maiko Cezar
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Martijn Verburg
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Interesting! As the wikipedia article suggests, there needed to be a conversion to unicode, glad you were able to solve it!
 
Poop goes in a willow feeder. Wipe with this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic