[patch, libfortran] UTF-8 Support, part 1

Tobias Burnus burnus@net-b.de
Mon Aug 4 12:01:00 GMT 2008


Jerry DeLisle wrote:
> This initial patch provides partial support for ENCODING="utf-8" I/O.
I did some tests. First results:

a) I have not tried without your patch, but the following gives an ICE:
  f951: internal compiler error: in gfc_interpret_character, at 
fortran/target-memory.c:402
I should try with an unmodified 4.4 compiler and fill a bug report.

  write(*,'(a)') transfer(int(z'bde4'),4_'a')
  end


b) If I run the following program, I expect as result:
 뷠 len= 1
However, I get 255 times "뷠" and len=255. If I use a "normal" ascii 
text (i.e. without option -fbackslash), I get that text, padded by "0" 
(I really mean the digit 0 not achar(0)). The written file looks fine 
thus this seems to be a reading problem.

character(len=255,kind=4) :: str
open(6,encoding="UTF-8")
open(66,file="test.txt",encoding="UTF-8",status="replace")
write(66,'(a)') 4_'\ubde0'
rewind(66)
read(66,'(a)') str
write(*,*) trim(str),' len=',len(trim(str))
end


c) Here, I'm not 100% sure what to expect, but I think the output should 
be "? 1" and not "뷠 3":
character(len=255,kind=1) :: str
open(66,file="test.txt",encoding="UTF-8",status="replace")
write(66,'(a)') 4_'\ubde0'
rewind(66)
read(66,'(a)') str
write(*,*) trim(str),len(trim(str))
end

Tobias



More information about the Gcc-patches mailing list