Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Simplest Possible Way To Disable Unicode

by John M. Dlugosz (Monsignor)
on May 24, 2011 at 00:27 UTC ( #906388=note: print w/ replies, xml ) Need Help??


in reply to Simplest Possible Way To Disable Unicode

That is a fascinating topic. I've run into that error from time to time, and others get it in a different situation from you: when the internal data is already known to be the same as how it should be written (UTF-8).

I think Perl has ratcheted up its features and gradually changed things, and you skipped too many generations in one go.

What version are you using now? The latest 5.14?

I think lots of us would like to discuss or at least see how "wide" data comes to be (you didn't store a funny character directly, right?) and what can control that.

So, it would be especially good if you could post a trivial program that does some manipulation (that's not obviously referring to any wide characters directly), writes it out, and gets that error.


Comment on Re: Simplest Possible Way To Disable Unicode
Re^2: Simplest Possible Way To Disable Unicode
by ikegami (Pope) on May 24, 2011 at 00:42 UTC

    when the internal data is already known to be the same as how it should be written (UTF-8).

    syswrite and print print the string, not its internal data. The internal storage format is not relevant here.

    >perl -we"$_ = chr(0xE9); utf8::downgrade($_); print;" | perl -nE"say +length;" 1 >perl -we"$_ = chr(0xE9); utf8::upgrade($_); print;" | perl -nE"say le +ngth;" 1 >perl -we"$_ = chr(1000); utf8::upgrade($_); print;" | perl -nE"say le +ngth;" Wide character in print at -e line 1. 2

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://906388]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (8)
As of 2014-12-28 14:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (181 votes), past polls