Problems with exported translations displaying properly using accented characters

Asked by Trevor Slocum

I'm having trouble getting accents to display in pages, coming from languages such as Spanish. I'm sending pages as UTF-8, and thought that gettext would also send the translated files as such, however I end up with odd characters which aren't as they should be. Any help would be greatly appreciated :)

Question information

English Edit question
Launchpad itself Edit question
No assignee Edit question
Solved by:
James Henstridge
Last query:
Last reply:
Revision history for this message
Best James Henstridge (jamesh) said :

The gettext library has the ability to transcode translations, so it is entirely possible for the MO file to be in UTF-8 but for the gettext() function to return strings in some other character encoding if you aren't in a UTF-8 locale.

If you are writing a GTK application where strings are expected to be in UTF-8 no matter what the locale says, I'd suggest using the bind_textdomain_codeset() function to fix the charset for your translation domain.

Revision history for this message
Trevor Slocum (tslocum) said :

I didn't notice that function existed. Thanks a lot :)