Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Dear monks, this one is a bit unusual: my Tk app handles utf-8 strings entered into a Tk entry box fine, but when the same app is packaged into an exe with pp, some characters are corrupted. Specifically, ű becomes û and ő becomes õ (I hope these show up as intended here). They already show up incorrectly as you type them, and are printed to file incorrectly as well. This occurs both on Win7 and XP.
All other characters I tested are fine, including cyrillic and Arabic ones, but of course that's not entirely reassuring. How likely is it that other characters will also be corrupted? Is there any simple solution I could try? I can work around this with a simple s/û/ű/g but that's no help if many other unknown characters are also corrupted. Is this problem in Tk? pp? Windows?
Interestingly, the two problem characters work fine when pasted into the entry box instead of typing them in.
Here's a short script that exhibits the issue (I imagine you'll have to switch to the Hungarian keyboard layout if you want to test it, given that the problem doesn't occur if you use Ctrl-c Ctrl-v):
use strict; use warnings; use Tk; use utf8; my $mw = Tk::MainWindow->new; $mw->minsize(300, 250); my $entered; my $entry = $mw->Entry( -textvariable => \$entered, -width => 75, -tak +efocus => 1 )->pack(); $entry->focus( -force ); open (OUT, ">>:encoding(UTF-8)", "_entered.txt"); my $go = sub { print OUT "$entered\n"; }; my $buttgo = $mw -> Button( -text=>"Go", -command => $go ) -> pack(); $mw->bind( '<Return>', $go ); my $buttexit = $mw -> Button( -text=>"Exit", -command => sub {exit}, ) -> pack(); Tk::MainLoop();

And here's the exe from the same script: https://www.dropbox.com/s/dyxir5rd4et0fj7/entry.exe

In reply to Odd encoding problem in Tk app when packaged with pp by elef

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 learning in the Monastery: (7)
As of 2024-03-28 22:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found