summaryrefslogtreecommitdiff
path: root/pcretest.c
diff options
context:
space:
mode:
authorph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2008-07-07 17:45:23 +0000
committerph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2008-07-07 17:45:23 +0000
commitbe88e9fc647d2d583bc3420bbe013230196fc443 (patch)
tree5fc7e858be9012349312388cd3aabf915ef0cfdd /pcretest.c
parent798472a8be18bffaa324fa1c6cc052895a063e47 (diff)
downloadpcre-be88e9fc647d2d583bc3420bbe013230196fc443.tar.gz
Make pcretest generate a single byte for \x{} escapes in non-UTF-8 mode.
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@355 2f5784b3-3f2a-0410-8824-cb99058d5e15
Diffstat (limited to 'pcretest.c')
-rw-r--r--pcretest.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/pcretest.c b/pcretest.c
index ac8290d..31d0357 100644
--- a/pcretest.c
+++ b/pcretest.c
@@ -1806,9 +1806,19 @@ while (!done)
{
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;
}