From: Nick Ing-Simmons Date: Fri, 26 Apr 2002 17:36:16 +0000 (+0000) Subject: Integrate mainline X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=5f228b1d3feafe3247efca23709f3c7bd5daf91b;p=p5sagit%2Fp5-mst-13.2.git Integrate mainline p4raw-id: //depot/perlio@16194 --- 5f228b1d3feafe3247efca23709f3c7bd5daf91b diff --cc ext/Encode/Encode.xs index be69c33,566d066..1311d8d --- a/ext/Encode/Encode.xs +++ b/ext/Encode/Encode.xs @@@ -140,21 -140,33 +140,33 @@@ encode_method(pTHX_ encode_t * enc, enc } goto ENCODE_SET_SRC; }else if (check & ENCODE_PERLQQ){ - SV* perlqq = + SV* perlqq = - sv_2mortal(newSVpvf("\\x{%04x}", ch)); + sv_2mortal(newSVpvf("\\x{%04"UVxf"}", ch)); sdone += slen + clen; ddone += dlen + SvCUR(perlqq); sv_catsv(dst, perlqq); + }else if (check & ENCODE_HTMLCREF){ - SV* htmlcref = ++ SV* htmlcref = + sv_2mortal(newSVpvf("&#%" UVuf ";", ch)); + sdone += slen + clen; + ddone += dlen + SvCUR(htmlcref); + sv_catsv(dst, htmlcref); + }else if (check & ENCODE_XMLCREF){ - SV* xmlcref = ++ SV* xmlcref = + sv_2mortal(newSVpvf("&#x%" UVxf ";", ch)); + sdone += slen + clen; + ddone += dlen + SvCUR(xmlcref); + sv_catsv(dst, xmlcref); - } else { + } else { /* fallback char */ sdone += slen + clen; - ddone += dlen + enc->replen; - sv_catpvn(dst, (char*)enc->rep, enc->replen); + ddone += dlen + enc->replen; + sv_catpvn(dst, (char*)enc->rep, enc->replen); } - } + } } /* decoding */ - else { + else { if (check & ENCODE_DIE_ON_ERR){ Perl_croak( aTHX_ "%s \"\\x%02X\" does not map to Unicode (%d)", @@@ -168,8 -180,9 +180,9 @@@ enc->name[0], (U8) s[slen], code); } goto ENCODE_SET_SRC; - }else if (check & ENCODE_PERLQQ){ - }else if (check & ++ }else if (check & + (ENCODE_PERLQQ|ENCODE_HTMLCREF|ENCODE_XMLCREF)){ - SV* perlqq = + SV* perlqq = sv_2mortal(newSVpvf("\\x%02X", s[slen])); sdone += slen + 1; ddone += dlen + SvCUR(perlqq);