Einzelnen Beitrag anzeigen

Kas Ob.

Registriert seit: 3. Sep 2023
347 Beiträge
 
#15

AW: Suche nach String mit 'decomposed' Character

  Alt 7. Okt 2024, 10:40
After smoking a cigarette here few more notes
4) there is a nice yet a little complicate documentation for LOCALE_NAME on Windows OS
https://learn.microsoft.com/en-us/wi...l/locale-names
if you want to use multiple LOCALE then you only can do with sort so value can be
Zitat:
<language>
<language>-<Script>
<language>-<Script>-<REGION>
<language>-<REGION>\_<sort order>
when needed there it can be combined with
<language>-<REGION>-x-<custom> or <language>-<Script>-<REGION>-x-<custom>
The IETF BCP 47 mentioned there is complete standardized and future proof.
https://www.rfc-editor.org/info/bcp47

5) Notice that : I tried to stay away from the lengths of the parameters i passed to FindNLSStringX, because it can be tricky and easily can go wrong and cause overflow, generating wide range of problems from AV in the OS API to simple corrupted data, the reason is these functions require the length in chars, and here is the problem with this terminology, what is char ?
Is it render-able one or code unit which 2 bytes for Delphi by default and Windows also by default has 2 bytes WideChar, the troubles comes from using or mixing different API such as WideCharToMultiByte this one in particular can be very dangerous due its ability to handle almost everything, and by MultiByte you should never assume it is 2 bytes output or even input for that API.
The moral of this is to do as i do, prefer to stay away as far as you can from calculating the length or passing it, and try to stay on the safe side by leaning on using the null-terminating strings while passing (-1) as length, the API is safer that way.

Again hope that helps somebody !
Kas
  Mit Zitat antworten Zitat