On Windows, the native charset is not UTF-8. Using these functions will
cause bugs such as [1] or [2].

Note that you can't simply replace all GetNative(Target|Path) to
Get(Target|Path) + NS_ConvertUTF16toUTF8. It will make things *worse*.
If you are using the path in logs or serialization formats (such as
[3]), probably it's OK to use NS_ConvertUTF16toUTF8. But if you are
passing the path to Operating system API functions or CRT functions,
probably you should change the function to a wide character variant
instead of converting the Unicode path. If you are passing the path to
some third-party libraries, read the documentation (or even the source)
of the library to determine the encoding of the path. If the library
wants the native charset, you will have to leave GetNative(Target|Path)
until the library is fixed to accept wide character paths or UTF-8 paths.

If you are not sure what to do with the Get(Target|Path) result, please
do not hesitate to ask me.

[1] https://bugzilla.mozilla.org/show_bug.cgi?id=1418325
[2] https://bugzilla.mozilla.org/show_bug.cgi?id=1420427
[3] https://bugzilla.mozilla.org/show_bug.cgi?id=1363482
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to