1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* enc/big5.c: Fix EncLen_BIG5 for Big5-HKSCS. see [ruby-core:24390]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24267 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2009-07-24 16:15:53 +00:00
parent 2886207584
commit a8951a5b3a
2 changed files with 39 additions and 18 deletions

View file

@ -1,7 +1,12 @@
Sat Jul 25 01:05:59 2009 NARUSE, Yui <naruse@ruby-lang.org>
* enc/big5.c: Fix EncLen_BIG5 for Big5-HKSCS. see [ruby-core:24390]
Fri Jul 24 19:19:19 2009 Martin Duerst <duerst@it.aoyama.ac.jp>
* enc/trans/big5.trans, big5-hkscs-tbl.rb:
new Chinese BIG5-HKSCS transcoding (with Tatsuya Mizuno)
see [ruby-core:24390]
* test/ruby/test_transcode.rb: added tests for the above
(with Tatsuya Mizuno)

52
enc/big5.c Normal file → Executable file
View file

@ -30,22 +30,23 @@
#include "regenc.h"
static const int EncLen_BIG5[] = {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
/* D */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
/* E */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
/* F */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1,
};
typedef enum { FAILURE = -2, ACCEPT = -1, S0 = 0, S1 } state_t;
@ -195,6 +196,13 @@ big5_is_allowed_reverse_match(const UChar* s, const UChar* end ARG_UNUSED, OnigE
return (BIG5_ISMB_TRAIL(c) ? FALSE : TRUE);
}
/*
* Name: Big5 (preferred MIME name)
* MIBenum: 2026
* Source: Chinese for Taiwan Multi-byte set.
* PCL Symbol Set Id: 18T
* Alias: csBig5
*/
OnigEncodingDefine(big5, BIG5) = {
big5_mbc_enc_len,
"Big5", /* name */
@ -213,5 +221,13 @@ OnigEncodingDefine(big5, BIG5) = {
big5_left_adjust_char_head,
big5_is_allowed_reverse_match
};
ENC_ALIAS("CP950", "BIG5")
ENC_REPLICATE("BIG5-HKSCS", "BIG5")
ENC_ALIAS("CP950", "Big5")
/*
* Name: Big5-HKSCS
* MIBenum: 2101
* Source: See (http://www.iana.org/assignments/charset-reg/Big5-HKSCS)
* Alias: None
*/
ENC_REPLICATE("Big5-HKSCS", "Big5")
ENC_ALIAS("CP951", "Big5-HKSCS")