Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^6: Global substitution of non-base-plane Unicode characters

by Jim (Curate)
on Feb 24, 2014 at 17:43 UTC ( [id://1076008]=note: print w/replies, xml ) Need Help??


in reply to Re^5: Global substitution of non-base-plane Unicode characters
in thread Global substitution of non-base-plane Unicode characters

TIMTOWTDI.

In Perl, printing exactly one character—a Unicode byte order mark—and nothing else is a special case of formatted printing, vis-à-vis generalized printing of lines of text with built-in programming conveniences (e.g., automatic newline handling).

Would you find this troublesome?

printf '%s', "\N{U+FEFF}";

Or this?

printf '%c', 0xfeff;

Jim

Replies are listed 'Best First'.
Re^7: Global substitution of non-base-plane Unicode characters
by kcott (Archbishop) on Feb 25, 2014 at 00:30 UTC

    This really has nothing to do with what, if anything, I find "troublesome".

    You hit the nail on the head with your earlier post: "Using printf in this admittedly unusual way ...".

    Writing code in an unusual way (without any indication of why this was done) makes future maintenance error-prone.

    Yes, there's more than one way to do it. Here's another, that simply adds a comment, that I would consider better:

    printf "\x{FEFF}"; # printf() so $\ is not appended

    -- Ken

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (7)
As of 2024-04-25 11:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found