--- code/trunk/pcretest.c 2008/04/21 16:30:37 343 +++ code/trunk/pcretest.c 2008/07/09 11:03:07 358 @@ -94,10 +94,11 @@ #include "pcre.h" #include "pcre_internal.h" -/* We need access to the data tables that PCRE uses. So as not to have to keep -two copies, we include the source file here, changing the names of the external -symbols to prevent clashes. */ +/* We need access to some of the data tables that PCRE uses. So as not to have +to keep two copies, we include the source file here, changing the names of the +external symbols to prevent clashes. */ +#define _pcre_ucp_gentype ucp_gentype #define _pcre_utf8_table1 utf8_table1 #define _pcre_utf8_table1_size utf8_table1_size #define _pcre_utf8_table2 utf8_table2 @@ -1255,15 +1256,15 @@ if (strncmp((char *)pp, "JS>", 3) == 0) { options |= PCRE_JAVASCRIPT_COMPAT; - pp += 3; + pp += 3; } else - { + { int x = check_newline(pp, outfile); if (x == 0) goto SKIP_DATA; options |= x; while (*pp++ != '>'); - } + } } break; @@ -1805,9 +1806,19 @@ { unsigned char buff8[8]; int ii, utn; - utn = ord2utf8(c, buff8); - for (ii = 0; ii < utn - 1; ii++) *q++ = buff8[ii]; - c = buff8[ii]; /* Last byte */ + if (use_utf8) + { + utn = ord2utf8(c, buff8); + for (ii = 0; ii < utn - 1; ii++) *q++ = buff8[ii]; + c = buff8[ii]; /* Last byte */ + } + else + { + if (c > 255) + fprintf(outfile, "** Character \\x{%x} is greater than 255 and " + "UTF-8 mode is not enabled.\n" + "** Truncation will probably give the wrong result.\n", c); + } p = pt + 1; break; }