diff options
| author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-01 14:29:25 +0000 |
|---|---|---|
| committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-01 14:29:25 +0000 |
| commit | dfe9d6f8e3923fb0dbb844f10eec7b37e76ba854 (patch) | |
| tree | e70256bcfd2cd49df2b0cfedc9da47433f2c796c | |
| parent | f6a8846ddb62ce91b28e5c07e25ba75e70707db3 (diff) | |
| download | ruby-dfe9d6f8e3923fb0dbb844f10eec7b37e76ba854.tar.gz ruby-dfe9d6f8e3923fb0dbb844f10eec7b37e76ba854.tar.xz ruby-dfe9d6f8e3923fb0dbb844f10eec7b37e76ba854.zip | |
* transcode.c (transcode_loop): undefined character is replaced with
only one character. [ruby-dev:35709]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18312 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
| -rw-r--r-- | ChangeLog | 5 | ||||
| -rw-r--r-- | transcode.c | 5 |
2 files changed, 10 insertions, 0 deletions
@@ -1,3 +1,8 @@ +Fri Aug 1 23:26:45 2008 NARUSE, Yui <naruse@ruby-lang.org> + + * transcode.c (transcode_loop): undefined character is replaced with + only one character. [ruby-dev:35709] + Fri Aug 01 23:26:22 2008 Yuki Sonoda (Yugui) <yugui@yugui.jp> Merged r16430(akr), r16431(akr), r16433(akr), r16469(nobu), and diff --git a/transcode.c b/transcode.c index 4ad1f6fb0..f79ad6dbd 100644 --- a/transcode.c +++ b/transcode.c @@ -186,6 +186,7 @@ transcode_loop(const unsigned char **in_pos, unsigned char **out_pos, unsigned char next_byte; int from_utf8 = my_transcoder->from_utf8; unsigned char *out_s = out_stop - my_transcoder->max_output + 1; + rb_encoding *from_encoding = rb_enc_find(my_transcoder->from_encoding); rb_encoding *to_encoding = rb_enc_find(my_transcoder->to_encoding); while (in_p < in_stop) { @@ -277,6 +278,10 @@ transcode_loop(const unsigned char **in_pos, unsigned char **out_pos, /* valid character in from encoding * but no related character(s) in to encoding */ /* todo: add more alternative behaviors */ + { + int len = rb_enc_mbclen((const char *)char_start, (const char *)in_stop, from_encoding); + while (in_p < char_start + len) in_p++; + } if (opt&UNDEF_IGNORE) { continue; } |
