summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorSADAHIRO Tomoyuki <BQW10602@nifty.com>2004-06-06 09:37:21 +0900
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2004-06-06 07:49:27 +0000
commit78ea37eb92d97de2362f1599aa0c3f43c5e70866 (patch)
tree0d0a05bdd7716d72c4368a8e833e553689f45ddb /sv.c
parente2736246f9096d0e04a2974deaf51d6950e0ac3f (diff)
downloadperl-78ea37eb92d97de2362f1599aa0c3f43c5e70866.tar.gz
Re: [PATCH] [perl #29841] utf8::decode doesn't work under -T
Message-Id: <20040606003344.57B2.BQW10602@nifty.com> p4raw-id: //depot/perl@22902
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/sv.c b/sv.c
index ab21d765df..501d09f81f 100644
--- a/sv.c
+++ b/sv.c
@@ -3907,7 +3907,7 @@ Perl_sv_utf8_upgrade(pTHX_ register SV *sv)
/*
=for apidoc sv_utf8_upgrade
-Convert the PV of an SV to its UTF-8-encoded form.
+Converts the PV of an SV to its UTF-8-encoded form.
Forces the SV to string form if it is not already.
Always sets the SvUTF8 flag to avoid future validity checks even
if all the bytes have hibit clear.
@@ -3917,7 +3917,7 @@ use the Encode extension for that.
=for apidoc sv_utf8_upgrade_flags
-Convert the PV of an SV to its UTF-8-encoded form.
+Converts the PV of an SV to its UTF-8-encoded form.
Forces the SV to string form if it is not already.
Always sets the SvUTF8 flag to avoid future validity checks even
if all the bytes have hibit clear. If C<flags> has C<SV_GMAGIC> bit set,
@@ -3986,9 +3986,9 @@ Perl_sv_utf8_upgrade_flags(pTHX_ register SV *sv, I32 flags)
/*
=for apidoc sv_utf8_downgrade
-Attempt to convert the PV of an SV from UTF-8-encoded to byte encoding.
-This may not be possible if the PV contains non-byte encoding characters;
-if this is the case, either returns false or, if C<fail_ok> is not
+Attempts to convert the PV of an SV from characters to bytes.
+If the PV contains a character beyond byte, this conversion will fail;
+in this case, either returns false or, if C<fail_ok> is not
true, croaks.
This is not as a general purpose Unicode to byte encoding interface:
@@ -4000,7 +4000,7 @@ use the Encode extension for that.
bool
Perl_sv_utf8_downgrade(pTHX_ register SV* sv, bool fail_ok)
{
- if (SvPOK(sv) && SvUTF8(sv)) {
+ if (SvPOKp(sv) && SvUTF8(sv)) {
if (SvCUR(sv)) {
U8 *s;
STRLEN len;
@@ -4030,9 +4030,8 @@ Perl_sv_utf8_downgrade(pTHX_ register SV* sv, bool fail_ok)
/*
=for apidoc sv_utf8_encode
-Convert the PV of an SV to UTF-8-encoded, but then turn off the C<SvUTF8>
-flag so that it looks like octets again. Used as a building block
-for encode_utf8 in Encode.xs
+Converts the PV of an SV to UTF-8, but then turns the C<SvUTF8>
+flag off so that it looks like octets again.
=cut
*/
@@ -4053,9 +4052,11 @@ Perl_sv_utf8_encode(pTHX_ register SV *sv)
/*
=for apidoc sv_utf8_decode
-Convert the octets in the PV from UTF-8 to chars. Scan for validity and then
-turn off SvUTF8 if needed so that we see characters. Used as a building block
-for decode_utf8 in Encode.xs
+If the PV of the SV is an octet sequence in UTF-8
+and contains a multiple-byte character, the C<SvUTF8> flag is turned on
+so that it looks like a character. If the PV contains only single-byte
+characters, the C<SvUTF8> flag stays being off.
+Scans PV for validity and returns false if the PV is invalid UTF-8.
=cut
*/
@@ -4063,7 +4064,7 @@ for decode_utf8 in Encode.xs
bool
Perl_sv_utf8_decode(pTHX_ register SV *sv)
{
- if (SvPOK(sv)) {
+ if (SvPOKp(sv)) {
U8 *c;
U8 *e;