diff options
author | Karsten Blees <blees@dcon.de> | 2011-11-25 21:05:06 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-06-10 13:32:59 -0700 |
commit | 1c950a594c40db7a946616cbc6cc5f9e25926a20 (patch) | |
tree | 592879456ccabc56c1a76259a123bde51cfca85a /wrapper.c | |
parent | Win32: warn if the console font doesn't support Unicode (diff) | |
download | tgif-1c950a594c40db7a946616cbc6cc5f9e25926a20.tar.xz |
Win32: add Unicode conversion functions
Add Unicode conversion functions to convert between Windows native UTF-16LE
encoding to UTF-8 and back.
To support repositories with legacy-encoded file names, the UTF-8 to UTF-16
conversion function tries to create valid, unique file names even for
invalid UTF-8 byte sequences, so that these repositories can be checked out
without error.
The current implementation leaves invalid UTF-8 bytes in range 0xa0 - 0xff
as is (producing printable Unicode chars \u00a0 - \u00ff, equivalent to
ISO-8859-1), and converts 0x80 - 0x9f to hex-code (\u0080 - \u009f are
control chars).
The Windows MultiByteToWideChar API was not used as it either drops invalid
UTF-8 sequences (on Win2k/XP; producing non-unique or even empty file
names) or converts them to the replacement char \ufffd (Vista/7; causing
ERROR_INVALID_NAME in subsequent calls to file system APIs).
Signed-off-by: Karsten Blees <blees@dcon.de>
Signed-off-by: Stepan Kasal <kasal@ucw.cz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'wrapper.c')
0 files changed, 0 insertions, 0 deletions