Re: Unicode/EBCDIC
[p5sagit/p5-mst-13.2.git] / utf8.c
diff --git a/utf8.c b/utf8.c
index 13b953a..55a8c7c 100644 (file)
--- a/utf8.c
+++ b/utf8.c
@@ -46,6 +46,8 @@ is the recommended Unicode-aware way of saying
 U8 *
 Perl_uv_to_utf8(pTHX_ U8 *d, UV uv)
 {
+    if (uv < 0x100) 
+    uv = NATIVE_TO_ASCII(uv);
     if (uv < 0x80) {
        *d++ = uv;
        return d;
@@ -200,7 +202,7 @@ Perl_is_utf8_string(pTHX_ U8 *s, STRLEN len)
 }
 
 /*
-=for apidoc A|U8* s|utf8_to_uv|STRLEN curlen|STRLEN *retlen|U32 flags
+=for apidoc A|UV|utf8_to_uv|U8 *s|STRLEN curlen|STRLEN *retlen|U32 flags
 
 Returns the character value of the first character in the string C<s>
 which is assumed to be in UTF8 encoding and no longer than C<curlen>;
@@ -254,7 +256,7 @@ Perl_utf8_to_uv(pTHX_ U8* s, STRLEN curlen, STRLEN* retlen, U32 flags)
     if (UTF8_IS_ASCII(uv)) {
        if (retlen)
            *retlen = 1;
-       return *s;
+       return ASCII_TO_NATIVE(*s);
     }
 
     if (UTF8_IS_CONTINUATION(uv) &&