ThomasMertes / seed7

Source code of Seed7
GNU General Public License v2.0
224 stars 12 forks source link

Unicode literal string cause RANGE_ERROR exception #30

Closed dram closed 4 months ago

dram commented 4 months ago

For following code, Seed7 will raise a RANGE_ERROR exception:

% cat hello.sd7
$ include "seed7_05.s7i";

const proc: main is func
  begin
    writeln("你好,世界");
  end func;

Tested in Debian with latest Seed7 (git 5a3fca2):

% s7 hello
SEED7 INTERPRETER Version 5.2.50  Copyright (c) 1990-2024 Thomas Mertes

*** Uncaught exception RANGE_ERROR raised with
{ext_file "\20320;\22909;\65292;\19990;\30028;" write }

Stack:
in write (val clib_file: outFile, ref string: stri) at /home/debian/seed7/seed7/lib/clib_file.s7i(215)
in write (inout file: outFile, ref string: stri) at /home/debian/seed7/seed7/lib/external_file.s7i(142)
in writeln (inout file: outFile, ref string: stri) at /home/debian/seed7/seed7/lib/null_file.s7i(106)
in writeln (ref string: stri) at /home/debian/seed7/seed7/lib/stdio.s7i(120)
in main at hello.sd7(5)
dram commented 4 months ago

Sorry, I should have read the FAQ more thoroughly, STD_CONSOLE fixes this problem. I only read the Is Unicode supported? section.

BTW, I kind of think that it would be nice if this is enabled by default, as well as $ names unicode, as Unicode support is quite universal now in programming languages.