summaryrefslogtreecommitdiff
path: root/utf8.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2002-01-29 22:23:25 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2002-01-29 22:23:25 +0000
commita241e37b95d268204ef242fe02597dc4dcdf9519 (patch)
tree63b7b9d9ef6541306438c7deb64b17fc2d47e17b /utf8.c
parent24952a9cd4e494b52de4ce12a5bb503bc5f60125 (diff)
downloadperl-a241e37b95d268204ef242fe02597dc4dcdf9519.tar.gz
EBCDIC tweaks-- no new test passes, but getting closer.
p4raw-id: //depot/perl@14491
Diffstat (limited to 'utf8.c')
-rw-r--r--utf8.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/utf8.c b/utf8.c
index 6bb259c674..0cdaf5f3cb 100644
--- a/utf8.c
+++ b/utf8.c
@@ -1292,9 +1292,7 @@ Perl_to_utf8_case(pTHX_ U8 *p, U8* ustrp, STRLEN *lenp, SV **swashp,char *normal
if (!*swashp)
*swashp = swash_init("utf8", normal, &PL_sv_undef, 4, 0);
uv = swash_fetch(*swashp, p, TRUE);
- if (uv)
- uv = UNI_TO_NATIVE(uv);
- else {
+ if (!uv) {
HV *hv;
SV *keysv;
HE *he;
@@ -1315,6 +1313,21 @@ Perl_to_utf8_case(pTHX_ U8 *p, U8* ustrp, STRLEN *lenp, SV **swashp,char *normal
ustrp[1] = UTF8_EIGHT_BIT_LO(c);
*lenp = 2;
}
+#ifdef EBCDIC
+ {
+ U8 tmpbuf[UTF8_MAXLEN_FOLD+1];
+ U8 *d = tmpbuf;
+ U8 *t, *tend;
+ STRLEN tlen;
+
+ for (t = ustrp, tend = t + *lenp; t < tend; t += tlen) {
+ UV c = utf8_to_uvchr(t, &tlen);
+ d = uvchr_to_utf8(d, UNI_TO_NATIVE(c));
+ }
+ *lenp = d - tmpbuf;
+ Copy(tmpbuf, ustrp, *lenp, U8);
+ }
+#endif
return utf8_to_uvchr(ustrp, 0);
}
}