-
-
- $str=decode("gb2312",$names[$index]);
- @chars=split(//,$str);
- foreach(@chars)
- {
- $ char=encode("gb2312",$_);
- print "ONE WORD:$charn";
- }
Copy code
Method 2:
Chinese characters occupy 2 bytes, so you can use the following statement to directly get the Chinese characters. The code is as follows:
-
-
- @chars=split(//,$names[$index]);
- $str=$chars[0].$chars[1];
Copy code
|