vic has asked for the wisdom of the Perl Monks concerning the following question:
I have a hash hard coded in the program (in ascii) and then I read some string from a XML file (in utf-8, string extract via libXML), the string and one of the key in hash are identical in content (same english alphabet), but the hash return nothing if I write in this way:
$value = $hard_code_hash{$utf8_string}
what happened?
I guess it may be the problem of the utf-8 string (query) and the non utf-8 string (key), but why it happen and any solution to this?
*the perl version is 5.8.5 (unix) and I can't upgrade it; store the perl file in utf-8 and call "use utf8" is not sound good as I do the programming on window, the utf-8 signature kill the perl interpreter
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: hard-coded hash return nothing for utf-8 string
by kyle (Abbot) on Feb 21, 2008 at 18:43 UTC | |
|
Re: hard-coded hash return nothing for utf-8 string
by Joost (Canon) on Feb 21, 2008 at 19:09 UTC | |
by vic (Initiate) on Feb 22, 2008 at 05:05 UTC | |
|
Re: hard-coded hash return nothing for utf-8 string
by Narveson (Chaplain) on Feb 21, 2008 at 18:27 UTC |