diff options
author | Inaba Hiroto <inaba@st.rim.or.jp> | 2000-12-30 23:27:10 +0900 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2000-12-30 17:14:19 +0000 |
commit | 1aa99e6b6d14c469ac825dde483d9c9f913a3ee2 (patch) | |
tree | 76ac8dd0d9473e84a19f6184baa4eddb6337e7b1 /mg.c | |
parent | 13e8c8e316d3839d0834fb8b851566b00d81e876 (diff) | |
download | perl-1aa99e6b6d14c469ac825dde483d9c9f913a3ee2.tar.gz |
more UTF8 test suites and an UTF8 patch
Message-ID: <3A4D722D.243AFD88@st.rim.or.jp>
Just the patch part for now, and the pragma renamed
as unicode::distinct.
p4raw-id: //depot/perl@8267
Diffstat (limited to 'mg.c')
-rw-r--r-- | mg.c | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -366,6 +366,11 @@ Perl_magic_regdatum_get(pTHX_ SV *sv, MAGIC *mg) i = t; else /* @- */ i = s; + + if (i > 0 && DO_UTF8(PL_reg_sv)) { + char *b = rx->subbeg; + i = Perl_utf8_length(aTHX_ (U8*)b, (U8*)(b+i)); + } sv_setiv(sv,i); } } @@ -1410,7 +1415,14 @@ Perl_magic_setsubstr(pTHX_ SV *sv, MAGIC *mg) { STRLEN len; char *tmps = SvPV(sv,len); - sv_insert(LvTARG(sv),LvTARGOFF(sv),LvTARGLEN(sv), tmps, len); + if (DO_UTF8(sv)) { + sv_utf8_upgrade(LvTARG(sv)); + sv_insert(LvTARG(sv),LvTARGOFF(sv),LvTARGLEN(sv), tmps, len); + SvUTF8_on(LvTARG(sv)); + } + else + sv_insert(LvTARG(sv),LvTARGOFF(sv),LvTARGLEN(sv), tmps, len); + return 0; } |