cvsuser     03/08/20 02:43:17

  Modified:    include/parrot unicode.h
               t/op     string.t
  Log:
  Fix UTF8 encoding error and add test for transcode to UTF8
  
  Revision  Changes    Path
  1.6       +3 -3      parrot/include/parrot/unicode.h
  
  Index: unicode.h
  ===================================================================
  RCS file: /cvs/public/parrot/include/parrot/unicode.h,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -w -r1.5 -r1.6
  --- unicode.h 21 Jul 2003 18:00:42 -0000      1.5
  +++ unicode.h 20 Aug 2003 09:43:10 -0000      1.6
  @@ -1,7 +1,7 @@
   /* unicode.h
    *  Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
    *  CVS Info
  - *     $Id: unicode.h,v 1.5 2003/07/21 18:00:42 chromatic Exp $
  + *     $Id: unicode.h,v 1.6 2003/08/20 09:43:10 petergibbs Exp $
    *  Overview:
    *     Unicode support header
    *  Data Structure and Algorithms:
  @@ -68,8 +68,8 @@
   #define UTF8_IS_CONTINUATION(c)         ((c) >= 0x80u && (c) <= 0xBFu)
   #define UTF8_IS_CONTINUED(c)            ((c) &  0x80u)
   
  -#define UTF8_START_MARK(len) (0xFEu << (7-len))
  -#define UTF8_START_MASK(len) (0x1Fu >> (len-2))
  +#define UTF8_START_MARK(len) (len == 1 ? 0 : 0x7Eu << (7-len))
  +#define UTF8_START_MASK(len) (len == 1 ? 0x7Fu : 0x1Fu >> (len-2))
   
   #define UTF8_CONTINUATION_MARK           0x80u
   #define UTF8_ACCUMULATION_SHIFT          6
  
  
  
  1.54      +13 -1     parrot/t/op/string.t
  
  Index: string.t
  ===================================================================
  RCS file: /cvs/public/parrot/t/op/string.t,v
  retrieving revision 1.53
  retrieving revision 1.54
  diff -u -w -r1.53 -r1.54
  --- string.t  8 Aug 2003 08:44:15 -0000       1.53
  +++ string.t  20 Aug 2003 09:43:16 -0000      1.54
  @@ -1,6 +1,6 @@
   #! perl -w
   
  -use Parrot::Test tests => 116;
  +use Parrot::Test tests => 117;
   use Test::More;
   
   output_is( <<'CODE', <<OUTPUT, "set_s_s|sc" );
  @@ -1976,6 +1976,18 @@
   ABCY
   abc
      Y
  +OUTPUT
  +
  +output_is( <<'CODE', <<OUTPUT, "transcode to utf8");
  +  set S1, "ASCII is the same as UTF8\n"
  +  find_encoding I1, "utf8"
  +  transcode S2, S1, I1
  +  print S1
  +  print S2
  +  end
  +CODE
  +ASCII is the same as UTF8
  +ASCII is the same as UTF8
   OUTPUT
   
   # Set all string registers to values given by &$_[0](reg num)
  
  
  

Reply via email to