Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^2: Writing UTF8 Filename

by Juerd (Abbot)
on Nov 17, 2007 at 09:47 UTC ( #651396=note: print w/ replies, xml ) Need Help??


in reply to Re: Writing UTF8 Filename
in thread Writing UTF8 Filename

(BTW, you might find it easier to use the perl built-in function "rename" -- it saves you from worrying about what happens to non-ASCII data being passed as command-line args to a sub-shell.)

Yeah, instead of worrying about what happens if you do a system call, you now have to worry about what happens if you do a system call. The same thing happens: latin1 or utf8 encoding may be used, depending on the circumstances. Thus: encode explicitly.

Juerd # { site => 'juerd.nl', do_not_use => 'spamtrap', perl6_server => 'feather' }


Comment on Re^2: Writing UTF8 Filename
Replies are listed 'Best First'.
Re^3: Writing UTF8 Filename
by amiribarksdale (Acolyte) on Nov 17, 2007 at 22:39 UTC

    Thank you all for your responses.

    Juerd, I am wondering what you mean when you keep saying "encode explicitly":

    The unicode strings I am trying to set as the filename are encoded as utf8 from a web form. They go into the utf8-character-set encoded mysql database. They display properly on the web form. What step for encoding explicitly could I be missing? It seems to me that they begin life as utf8 and they stay that way. How do I get more explicit?

      Juerd, I am wondering what you mean when you keep saying "encode explicitly":

      Perhaps it is time to read the Perl Unicode Tutorial :-).

      If they began life as utf8, they do indeed very probably stay that way if you do nothing to them, but if that were the case, I think you might not have been asking the question that you have.

      Encoding explicitly means to use encode() or encode_utf8(), in this case. It would also require that the values coming from the database are decoded at some point. The DBD::mysql module can do this for you. I don't know if it is.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (16)
As of 2015-07-07 22:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (93 votes), past polls