in reply to Re^5: Perl UTF-8 serving HTML5
in thread Perl UTF-8 serving HTML5
What kind of portability issues will I face when using something like this on Linux?
linux/windows/banana its all the same
count will always be wrong if you're counting characters, then afterwards doing conversion/encoding through binmode
utf8 is variable length encoding, some characters encode as 1 byte, others as 3, so counting characters to know the number of bytes that will result will never work except by accident , when all the characters are basic ascii/latin text anyway
Its like counting your chickens before the eggs hatch -- not all eggs will hatch, some will be twins, fox will eat four,
only real solution is to encode before counting (get the bytes, hatch the eggs, then count chickens)
|
|---|