From: Jarkko Hietaniemi Date: Tue, 29 Jan 2002 22:23:25 +0000 (+0000) Subject: EBCDIC tweaks-- no new test passes, but getting closer. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a241e37b95d268204ef242fe02597dc4dcdf9519;p=p5sagit%2Fp5-mst-13.2.git EBCDIC tweaks-- no new test passes, but getting closer. p4raw-id: //depot/perl@14491 --- diff --git a/utf8.c b/utf8.c index 6bb259c..0cdaf5f 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); } }