[Israel.pm] unicode characters in your code

Yosef Meller mellerf at netvision.net.il
Sat Mar 13 14:39:32 PST 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Mikhael Goikhman wrote:
| On 13 Mar 2004 09:09:20 +0200, Shlomo Yona wrote:
|
|>I'm using Perl 5.8.0 and am facing a problem with unicode
|>characters.
|>
|>I cannot seem to explicitly use a unicode character in the
|>code (say, in a regular expression pattern). I can, however,
|>use the \x{...} notation to represent the unicode character.
|>
|>Is there a way to explicitly use the unicode character in
|>the code?
|
|
| It is not clear from your question what is "unicode character".
|
| Do you mean that you want $str = "binary_data"; to be interpreted by Perl
| as utf8 string? I think (please someone correct me), Perl code itself is
| considered ascii, so this is not possible, you should either use \x{...}
| notation or read the unicode data from stdin/file using utf8 encoding.

If you put "use utf8;" at the beginning of your code you can write it
(or any string in it) directly as utf8. But I haven't tried it yet.
Check out perldoc utf8.


- --
perl -e'$b=unpack"b*",pack"H*","59dfce2d6b1664d3b26cd9969503";
for(;$a<length$b;$a+=9){print+pack"b8",substr$b,$a,8;}'

My public key:
http://wwwkeys.pgp.net:11371/pks/lookup?op=get&search=0x3D2CA0A8
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFAU42jaElZPz0soKgRAkU0AKCB03C7fNG1EVUvzW1CqLRUm7g72gCgn6P9
XR9kgWfArfwg+W6rItZ3YeI=
=JRTe
-----END PGP SIGNATURE-----



More information about the Perl mailing list