[PATCH] winex11: Escape non-UTF-8 characters in string literals

Alexandre Julliard julliard at winehq.org
Thu Jan 4 04:56:35 CST 2018


Alex Henrie <alexhenrie24 at gmail.com> writes:

> Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
> ---
> This is the only file in the Wine codebase that uses a character
> encoding other than UTF-8, and even so it still uses UTF-8 characters in
> its comments. Because practically no editor supports mixing encodings
> within the same file and because all patch submissions are assumed to be
> in git-send-email's default encoding (UTF-8), it is necessary to use
> UTF-8 consistently throughout the file to avoid mangled characters.
>
> I used this bit of Python to escape the characters, then I manually
> undid the changes in comments:
>
> from sys import stdout
>
> for char in open('dlls/winex11.drv/keyboard.c', 'rb').read():
>     if char <= 0x7F:
>         stdout.write(chr(char))
>     else:
>         stdout.write('\\' + hex(char)[1:])
>
>  dlls/winex11.drv/keyboard.c | 334 ++++++++++++++++++++++----------------------
>  1 file changed, 167 insertions(+), 167 deletions(-)

It doesn't build:

gcc -m32 -c -o keyboard.o keyboard.c -I. -I../../include -D__WINESRC__ -D_REENTRANT -fPIC -Wall -pipe \
  -fno-strict-aliasing -Wdeclaration-after-statement -Wempty-body -Wignored-qualifiers \
  -Wno-packed-not-aligned -Wshift-overflow=2 -Wstrict-prototypes -Wtype-limits \
  -Wunused-but-set-parameter -Wvla -Wwrite-strings -Wpointer-arith -Wlogical-op -gdwarf-2 \
  -gstrict-dwarf -fno-omit-frame-pointer -Werror -g -O2 -fno-diagnostics-show-caret
keyboard.c:288:14: error: hex escape sequence out of range [-Werror]
keyboard.c:288:43: error: hex escape sequence out of range [-Werror]
keyboard.c:288:56: error: hex escape sequence out of range [-Werror]
keyboard.c:288:64: error: hex escape sequence out of range [-Werror]
keyboard.c:573:11: error: hex escape sequence out of range [-Werror]
keyboard.c:573:37: error: hex escape sequence out of range [-Werror]
etc.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list