Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Dear PerlMonks,
I'm writing application using wxWidgets on MS Windows and have problem with localization. My locale initialization code is

undef $locale; $locale = Wx::Locale->new('Czech', 'cz','cz'); $locale->AddCatalogLookupPathPrefix(filename('data/locale')); $locale->AddCatalog('evidence');

The file data/locale/evidence.po contain UTF-8 encoded translated texts and UTF-8 is correctly specified as charset in Content-Type:

msgid "" msgstr "" "Project-Id-Version: evidence VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2007-07-26 22:49+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n"

but almost all accented letters are malformed. It looks like internal processing somewhere in (or behind) Wx::Locale convert all texts to Windows encoding and set the utf8 flag on...

Can somebody help me? I don't know what is going wrong. Maybe I'm using Wx::Locale in completely wrong way?

As a workaround I've wrote a wrapper routine, but it seems to me that there can be also bug in Encode module, because some chars are not converted properly (e.g. small letter c with caron - which I'm trying to fix with regexp later). Wrapper routine code is

sub _T { my $gettext; my $octets; my $result; $gettext = gettext(@_); $octets = Encode::encode(Wx::Locale::GetSystemEncodingName(), $gettex +t); $result = Encode::decode_utf8($octets, Encode::FB_PERLQQ); # fix czech small letter c< $result =~ s/\\xC4\?/\x{10d}/g; return $result; }

In reply to Localize Wx application - encoding problem by ph0enix

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (5)
As of 2024-04-19 12:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found