Re:Rapidstring: Maybe the fastest string library ever
by vbezhenar on Wednesday August 01, 2018 @01:34AM
(#17659952)
If you're using WinAPI, you have to use UCS-16. Converting strings for every call would be abysmal to performance.
[ Parent
| on HN ]
Re:Rapidstring: Maybe the fastest string library ever
by hrydgard on Wednesday August 01, 2018 @02:02AM
(#17660066)
For most software it's perfectly fine to convert. What Windows API call that takes string input do you call so often that it would be an issue?
Re:Rapidstring: Maybe the fastest string library ever
by flohofwoe on Wednesday August 01, 2018 @03:44AM
(#17660386)
There are only very few WinAPI functions which use UCS-2 vs ASCII, and none of them are performance-critical. It's totally fine to convert from/to UTF-8 on the fly, especially since the conversion is extremely cheap (and the rest of the world has moved on to UTF-8 anyway).
Re:Rapidstring: Maybe the fastest string library ever
by iforgotpassword on Wednesday August 01, 2018 @06:23AM
(#17661203)
All winapi functions use UCS2. The "ASCII" versions are just wrappers that implicitly convert from the current locale (latin1, ShiftJIS, BIG5, ...) to UCS2. Try passing some Japanese text to the ASCII version of a function on a system that's set to eg. German and see what happens...
Re:Rapidstring: Maybe the fastest string library ever
by flohofwoe on Wednesday August 01, 2018 @06:45AM
(#17661304)
Most Win32 API functions don't even take string parameters, so there's no separate ASCII or UCS-2 version of those.
Of the functions that take strings, the old ...A() versions should never be called anyway since they depend on the obsolete concept of code pages. The proper way to work with strings on Windows (IMHO) is to encode all string data to UTF-8, only encode/decode from/to UCS-2 when needed, and call the ...W() functions explicitely (don't use the global UNICODE define).
Also see: http://utf8everywhere.org/