Inform - Support - Patches

About Patches  

Compiler  
Library  

DM4 Errata  

Issue C62111

String array problem with non-ASCII characters
Submitted by: Kevin Bracey     Appeared in: Compiler 6.21 or before     Fixed in: Compiler 6.30
Problem

String arrays do not properly handle non-ASCII characters or escape sequences. Constructs like:

  Array city -> "København";
  Array city string "K@/obenhavn";

do not work properly. I found this out while fixing Zip 2000 to handle such things in @make_menu.

(Interestingly, @/ has been incorrectly documented as @\ ever since Graham's newsletter of December 1995 first described it.)

Solution

Apply this patch:

  --- arrays.c~        Wed Apr 28 21:13:54 1999
  +++ arrays.c         Wed Nov 21 12:18:02 2001
  @@ -356,9 +356,20 @@
       }

       {   assembly_operand chars;
  +        int j;
           chars.type = SHORT_CONSTANT_OT; chars.marker = 0;
  -        for (i=0; token_text[i]!=0; i++)
  -        {   chars.value = token_text[i];
  +        for (i=0,j=0; token_text[j]!=0; i++,j+=textual_form_length)
  +        {
  +            int32 unicode; int zscii;
  +            unicode = text_to_unicode(token_text+j);
  +            zscii = unicode_to_zscii(unicode);
  +            if ((zscii != 5) && (zscii < 0x100)) chars.value = zscii;
  +            else
  +            {   unicode_char_error(
  +                   "Character can only be used if declared in \
  +advance as part of 'Zcharacter table':", unicode);
  +                chars.value = '?';
  +            }
               array_entry(i, chars);
           }
       }


Last updated 17 April 2013. This web site has not been fully supported since April 2008. Information may be out of date. This page was originally managed by Roger Firth.