aboutsummaryrefslogtreecommitdiff
path: root/win32/mingw.c
diff options
context:
space:
mode:
authorAvi Halachmi (:avih) <avihpit@yahoo.com>2023-06-27 14:41:47 +0300
committerAvi Halachmi (:avih) <avihpit@yahoo.com>2023-07-22 09:40:16 +0300
commit0efc74740ebc0d98af79ba4a5dfa73bfb5db3df0 (patch)
treec21fd8650e8c197abb317831c1f84e6fcf021f8e /win32/mingw.c
parent4fe7e7cdd0441e9455cc93c17b40a7a96704e61f (diff)
downloadbusybox-w32-0efc74740ebc0d98af79ba4a5dfa73bfb5db3df0.tar.gz
busybox-w32-0efc74740ebc0d98af79ba4a5dfa73bfb5db3df0.tar.bz2
busybox-w32-0efc74740ebc0d98af79ba4a5dfa73bfb5db3df0.zip
win32: support build with FEATURE_UNICODE_SUPPORT
FEATURE_UTF8_MANIFEST enables Unicode args and filenames on Win 10+. FEATURE_UTF8_INPUT allows the shell prompt to digest correctly Unicode strings (as UTF8) which are typed or pasted. This commit adds support for building with FEATURE_UNICODE_SUPPORT (mostly by supporting 32 bit wchar_t which busybox expects): - Unicode-aware line-edit - for the most part cursor movement/del being (UTF8) codepoint-aware rather than assuming that one-byte equals one-char-on-screen. - Codepoint-aware operations in some other utils, like rev or wc -c. - When UNICODE_COMBINING_WCHARS and UNICODE_WIDE_WCHARS are enabled, some screen-width-aware operations, like with fold, ls, expand, etc. The busybox Unicode support is incomplete, and even less so with the builtin libc replacement functions, like wcwidth, which are active when UNICODE_USING_LOCALE is unset (mingw lacks those functions). FEATURE_CHECK_UNICODE_IN_ENV should be set so that Unicode is not hardcoded but rather depends on the ANSI codepage and some env vars: LC_ALL=C disables Unicode support, else it's enabled if ACP is UTF8. There's at least one known issue where the tab-completion-prefix-case is not updated correctly, e.g. ~/desk<tab> completes to ~/desktop/ instead of ~/Desktop/, because the code which handles it exists only at the non-unicode code paths, but that's not very critical. That seems to be the only case where mingw-specific code is disabled when Unicode is enabled, but there could be other unknown issues. None of the Unicode options is enabled by default, and the next commit will make it easier to create a build which supports Unicode.
Diffstat (limited to 'win32/mingw.c')
-rw-r--r--win32/mingw.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/win32/mingw.c b/win32/mingw.c
index 5e9c71226..dabb2a2e7 100644
--- a/win32/mingw.c
+++ b/win32/mingw.c
@@ -2119,6 +2119,20 @@ char * FAST_FUNC bs_to_slash(char *str)
2119 return str; 2119 return str;
2120} 2120}
2121 2121
2122#if ENABLE_UNICODE_SUPPORT
2123MINGW_BB_WCHAR_T * FAST_FUNC bs_to_slash_u(MINGW_BB_WCHAR_T *str)
2124{
2125 MINGW_BB_WCHAR_T *p;
2126
2127 for (p=str; *p; ++p) {
2128 if ( *p == '\\' ) {
2129 *p = '/';
2130 }
2131 }
2132 return str;
2133}
2134#endif
2135
2122void FAST_FUNC slash_to_bs(char *p) 2136void FAST_FUNC slash_to_bs(char *p)
2123{ 2137{
2124 for (; *p; ++p) { 2138 for (; *p; ++p) {