Re: [libxml++] Swap std::string for Glib::ustring



Hi Sean!


Sean Farrell schrieb:
I see the initial motivation of using Glib::ustring, since the strings
handled are UTF-8. But if one looks at the code, Glub::ustring is just
used as a container for UTF-8 and no real operations are done.

This is not correct. One big difference between Glib::ustring and std::ustring is the way lengths and positions in the string are handled. If you ask a std::ustring for its length you get the number of bytes, if you ask Glib::ustring you get the number of characters. Same if you handle with substrings and that like. This is very important if you have to truncate strings, with std::ustring you always risk to split a UTF-8 character in its middle if you do not take special care.


Matthias






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]