bug-ed
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-ed] [patch] ed treats none UTF-8


From: Takao Fujiwara
Subject: [Bug-ed] [patch] ed treats none UTF-8
Date: Tue, 21 Jul 2009 14:48:40 +0900
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1b3pre) Gecko/20090513 Fedora/3.0-2.3.beta2.fc11 Lightning/1.0pre Thunderbird/3.0b2

Hi,

The attaching patch fixes ed with the none UTF-8 handling.

Problem 1:
0. Invoke a terminal emulator on zh_CN.GB18030.
1. Create a file name of the code point 0x5c.
% echo "hello" > `/usr/bin/printf "\x81\x5c"`
2. Invoke ed with the created file name.
% env LC_MESSAGES=C ed `/usr/bin/printf "\x81\x5c"`
multi-byte: No such file or directory

Then ed outputs "No such file or directory".
The 0x 81 5c is a multi-byte char of GB18030 encoding.
My patch fixes strip_escapes() not to mistake a multi-byte and the single '\'.

Problem2:
1. Create a file with the content of 0x5b.
% /usr/bin/printf "abc\x81\x5bdef" > hello
% cat hello
abc乕def
2. Invoke ed with the created file and search the char with /.../ .
% ed hello
/ab/
abc乕def
/乕d/
?

The ed outputs '?'.
The 0x 81 5b is a char of GB18030 encoding.
My patch fixes extract_pattern() not to mistake the multi-byte and single '['.

I also fixed read_file()/write_file() to see the single byte '!' only.

Thanks,
fujiwara

Attachment: ed-508214-head-utf8-str.diff
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]