Re: [Mingw-w64-public] [PATCH] rewrite the dirname.c and basename.c without wide character processing

2023-03-25 Thread Alvin Wong via Mingw-w64-public
On 25/3/2023 17:28, LIU Hao wrote: 在 2023-03-25 12:35, Alvin Wong 写道: Can we just avoid converting to wide char at all and operate only in MBCS? IsDBCSLeadByte should be enough to allow these functions to skip any false matches on the second byte of double-byte chars. And it does not matter th

Re: [Mingw-w64-public] [PATCH] rewrite the dirname.c and basename.c without wide character processing

2023-03-25 Thread LIU Hao
在 2023-03-25 12:35, Alvin Wong 写道: Can we just avoid converting to wide char at all and operate only in MBCS? IsDBCSLeadByte should be enough to allow these functions to skip any false matches on the second byte of double-byte chars. And it does not matter that IsDBCSLeadByte doesn't work with U

Re: [Mingw-w64-public] [PATCH] rewrite the dirname.c and basename.c without wide character processing

2023-03-25 Thread 傅继晗
Yes, I totally agree with that. In that way, the UTF-8 filename would be processed without errors when the system default is DBCS locale. Alvin Wong 于2023年3月25日周六 12:35写道: > Can we just avoid converting to wide char at all and operate only in > MBCS? IsDBCSLeadByte should be enough to allow t

Re: [Mingw-w64-public] [PATCH] rewrite the dirname.c and basename.c without wide character processing

2023-03-24 Thread Alvin Wong via Mingw-w64-public
Can we just avoid converting to wide char at all and operate only in MBCS? IsDBCSLeadByte should be enough to allow these functions to skip any false matches on the second byte of double-byte chars. And it does not matter that IsDBCSLeadByte doesn't work with UTF-8, because the UTF-8 encoding a

Re: [Mingw-w64-public] [PATCH] rewrite the dirname.c and basename.c without wide character processing

2023-03-23 Thread LIU Hao
在 2023/3/23 14:42, 傅继晗 写道: Thanks for your attention! I really understand this time.But I still have a question,why dirname in linux glib doesn't process MBCS? Maybe they think input as UTF-8 as default? It's likely that no encoding has been abusing the ASCII forwardslash, so it needs no speci

Re: [Mingw-w64-public] [PATCH] rewrite the dirname.c and basename.c without wide character processing

2023-03-22 Thread 傅继晗
Thanks for your attention! I really understand this time.But I still have a question,why dirname in linux glib doesn't process MBCS? Maybe they think input as UTF-8 as default? LIU Hao 于2023年3月23日周四 13:30写道: > 在 2023-03-22 13:40, 傅继晗 写道: > > Hello: > > There is no need to convert multi-byte char

Re: [Mingw-w64-public] [PATCH] rewrite the dirname.c and basename.c without wide character processing

2023-03-22 Thread LIU Hao
在 2023-03-22 13:40, 傅继晗 写道: Hello: There is no need to convert multi-byte characters to wide-byte characters and then convert from wide-byte to multi-byte, just deal with multi-byte directly as __xpg_basename in gnu as this: glibc/xpg_basename.c at master · lattera/glibc (github.com)

[Mingw-w64-public] [PATCH] rewrite the dirname.c and basename.c without wide character processing

2023-03-21 Thread 傅继晗
Hello: There is no need to convert multi-byte characters to wide-byte characters and then convert from wide-byte to multi-byte, just deal with multi-byte directly as __xpg_basename in gnu as this: glibc/xpg_basename.c at master · lattera/glibc (github.com)