=========================
Case 1: create string from pack, with use bytes
char semantics: ƐIJ Length = 2, Content = 400.306
byte semantics: ƐIJ Length = 4, Content = 198.144.196.178
198.144.196.178
=========================
Case 2: create string from pack, with use buyes
char semantics: ƐIJ Length = 2, Content = 400.306
byte semantics: ƐIJ Length = 4, Content = 198.144.196.178
400.306
=========================
Case 3: create string from \x{}
char semantics: ƐIJ Length = 2, Content = 400.306
byte semantics: ƐIJ Length = 4, Content = 198.144.196.178
400.306
=========================
Case 4: read string from unicode file
char semantics: 裴佳谷
Length = 4, Content = 35060.20339.35895.10
byte semantics: 裴佳谷
Length = 10, Content = 232.163.180.228.189.179.232.176.183.10
Also, I want to add a case to cover the situation where you read your string from file:
{ print "=========================\n"; print "Case 4: read string from utf8 file\n"; open(FILE, "<:utf8", "test.txt"); $encoded_string = <FILE>; display $encoded_string; }
In reply to Re: Re: Re: use bytes and length problem
by pg
in thread use bytes and length problem
by muad33b
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |