Thanks for your reply.

 

Excuse me for Further question:

 

What’s the ‘\0’ use for?

 

I got the result of 21 when I put in more Chinese character like:  $str=”我
們一起看雲去”;

 

There are 7 Chinese words in the string, 

Does it mean every single Chinese word have to come with a single ‘\0’? 

What for?

What is the benefit?

 

Thanks again.

 

 

 

 

 

  _____  

From: Thomas Yan [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 16, 2007 2:14 PM
To: Neil; beginners@perl.org
Subject: Re: Chinese word problem

 

'我' takes 2 bytes  '\0' takes 1 byte , so "我“ takes 3

 

Every chinese charecter takes 2 bytes

----- Original Message ----- 

From: Neil <mailto:[EMAIL PROTECTED]>  

To: beginners@perl.org 

Sent: Wednesday, May 16, 2007 1:57 PM

Subject: Chinese word problem

 

Dear All:

 

Question:

How come the length of Chinese word I print shows “ 3 “.

Isn’t it supposed to 2 bytes?

 

Program:

-----------------------------------

$str=”我”;

$str_len = length($str);

Print $str_len, “\n\n”;

------------------------------------

The result is 3

 

I took a picture for the program. In case of it doesn’t show Chinese word
in some of your system,

Pls see the attachment

 

My environment:

CPU: Intel Pentium C2D T7200

OS: Fedora Core 6

Perl V: 5.8.8

Encode: Big5

 

Thank you 

 


  _____  


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/

Reply via email to