Re:Smjörið er brætt og hveitið smátt og smátt hrært út í það...
by dzorz on Thursday February 07, 2008 @05:11PM
(#111455)
Could you offer a better solution? What would your solution offer that octets do not? Random character access? No, because not a single unicode encoding offers easy random character access (because they are made of possibly several codepoints, which, in some encodings, are made of more than one basic "chars"). Gylph, word and sentence segmentation? I guess not.
[ Parent
| on HN ]
Re:Smjörið er brætt og hveitið smátt og smátt hrært út í það...
by olavk on Thursday February 07, 2008 @06:10PM
(#111538)
Abstraction. Having Unicode strings (i.e. strings that are a sequence of Unicode code points rather than octets) allows you to work with strings without worrying about encoding (except when doing IO, which is where encoding matters).
If you treat strings as octets OTOH even simple operations like concatenating two strings might lead to headache if the strings are in two different encodings. And how do you keep track of the encodings of individual strings? Madness lies down that road.