icu icon indicating copy to clipboard operation
icu copied to clipboard

Update ufile.cpp

Open defrag257 opened this issue 4 years ago • 3 comments

When Windows API is available, use Windows API _wfopen instead. Don't expect u_fopen to fail, because it might cause a mojibaked file name without a fail when perm contains "w" or "a".

Checklist
  • [ ] Issue filed: https://unicode-org.atlassian.net/browse/ICU-_____
  • [ ] Updated PR title and link in previous line to include Issue number
  • [ ] Issue accepted
  • [ ] Tests included
  • [ ] Documentation is changed or added

defrag257 avatar Jan 05 '20 07:01 defrag257

Thank you for creating a PR!

Would you be able to also create a bug/ticket for this change as well? https://unicode-org.atlassian.net/secure/Dashboard.jspa

jefgen avatar Jan 08 '20 19:01 jefgen

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Mar 10 '20 05:03 CLAassistant

Thanks for signing the CLA. Could you please file an issue at https://unicode-org.atlassian.net/ ? (All commits and PRs need to have a corresponding ticket). Thanks!

jefgen avatar Mar 11 '20 18:03 jefgen

@rp9-next is this worth doing and looks like a good start? If so, please file a ticket on the author's behalf. If not, please close this PR.

markusicu avatar Jan 12 '23 17:01 markusicu

The PR points the reason for the changes as mojibaked text for fopen on windows. The windows docs, however point out that the functioning of fopen and _wfopen as the same (The latter being widechar version of the former). Closing this now. Please re-open if required.

rp9-next avatar Jan 19 '23 06:01 rp9-next

Documentations are not always reliable. Sad to see this PR closed. :( In Windows, a wide char actually supports a lot more chars than a narrow char. They are NOT THE SAME. Wide chars in Windows are in UTF-16LE encoding, which supports Unicode chars 0~0x10FFFF using one or two 16-bit wide chars. Especially, wide chars support emojis. 🙂 Narrow chars differs from one country/region to another. For example, the US English version of Windows uses Windows-1252, which only supports 256 chars. No emoji supports at all. ☹

defrag257 avatar May 09 '23 07:05 defrag257