Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Simplest Possible Way To Disable Unicode

by John M. Dlugosz (Monsignor)
on May 24, 2011 at 00:27 UTC ( [id://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

Replies are listed 'Best First'.
Re^2: Simplest Possible Way To Disable Unicode
by ikegami (Patriarch) 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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://906388]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2024-04-24 07:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found