diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-07-05 00:54:11 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-07-05 00:54:11 +0000 |
commit | ed37bfcc9d4306e47f4c73e0eeca202cb1e00d9d (patch) | |
tree | 93b609a02094a7a57d442a2e034a5045fa2400a0 /regenc.c | |
parent | 660fed67411b977d8995cba150d0b05a3fddeb50 (diff) | |
download | ruby-ed37bfcc9d4306e47f4c73e0eeca202cb1e00d9d.tar.gz |
broken utf-8
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41786 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'regenc.c')
-rw-r--r-- | regenc.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -55,10 +55,12 @@ extern int onigenc_mbclen_approximate(const OnigUChar* p,const OnigUChar* e, struct OnigEncodingTypeST* enc) { int ret = ONIGENC_PRECISE_MBC_ENC_LEN(enc,p,e); - if (ONIGENC_MBCLEN_CHARFOUND_P(ret)) - return ONIGENC_MBCLEN_CHARFOUND_LEN(ret); - else if (ONIGENC_MBCLEN_NEEDMORE_P(ret)) + if (ONIGENC_MBCLEN_NEEDMORE_P(ret)) return (int)(e-p)+ONIGENC_MBCLEN_NEEDMORE_LEN(ret); + else if (ONIGENC_MBCLEN_INVALID_P(ret)) + return (int)(e-p)+ONIGENC_MBCLEN_INVALID_LEN(ret); + else if (ONIGENC_MBCLEN_CHARFOUND_P(ret)) + return ONIGENC_MBCLEN_CHARFOUND_LEN(ret); return 1; } |