summaryrefslogtreecommitdiff
path: root/sample/encode.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2016-05-10 05:12:17 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2016-05-10 05:12:17 +0200
commit5e01a4852b31d537307994248869caf38b4023cc (patch)
tree769c60020afcb58437477f348dca58fb0c789f64 /sample/encode.c
parent766e109fd638ef1eac33717b52e04a351da46483 (diff)
Imported Upstream version 6.0.0upstream/6.0.0
Diffstat (limited to 'sample/encode.c')
-rw-r--r--sample/encode.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/sample/encode.c b/sample/encode.c
index 3fbd03d..1daafa9 100644
--- a/sample/encode.c
+++ b/sample/encode.c
@@ -52,6 +52,8 @@ exec(OnigEncoding enc, OnigOptionType options,
UChar* pattern = (UChar* )apattern;
UChar* str = (UChar* )astr;
+ onig_initialize(&enc, 1);
+
r = onig_new(&reg, pattern,
pattern + onigenc_str_bytelen_null(enc, pattern),
options, enc, ONIG_SYNTAX_DEFAULT, &einfo);
@@ -92,6 +94,8 @@ exec_deluxe(OnigEncoding pattern_enc, OnigEncoding str_enc,
UChar* pattern = (UChar* )apattern;
UChar* str = (UChar* )astr;
+ onig_initialize(&str_enc, 1);
+
ci.num_of_elements = 5;
ci.pattern_enc = pattern_enc;
ci.target_enc = str_enc;
@@ -124,6 +128,12 @@ extern int main(int argc, char* argv[])
static unsigned char str[] = { 0xc7, 0xd6, 0xfe, 0xea, 0xe0, 0xe2, 0x00 };
static unsigned char pattern[] = { 0xe7, 0xf6, 0xde, '\\', 'w', '+', 0x00 };
+ r = exec(ONIG_ENCODING_SJIS, ONIG_OPTION_NONE,
+ "^a\\p{Hiragana}c$", "a\202\274c");
+
+ r = exec(ONIG_ENCODING_EUC_JP, ONIG_OPTION_NONE,
+ "^a\\p{Hiragana}c$", "a\244\276c");
+
r = exec(ONIG_ENCODING_CP1251, ONIG_OPTION_IGNORECASE,
"aBc", " AbC");