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

Jerry DeLisle jvdelisle@verizon.net
Mon Aug 11 05:12:00 GMT 2008


Here is an updated patch addressing Tobias' comments.

I have provided two test cases that test a number of combinations of things.  I 
am sure it does not cover all possibilities, but it is a start.

I have revised the reading of UTF-8 and factored the code differently, allowing 
use of the new read_utf8 function where needed.  One can now read into a KIND=1 
string with ENCODING="utf-8" and the non-representable characters are given the 
value of '?'

In the previous patch I incorrectly handled the padding of a string on a short 
read.  Short means the record is shorter than the string.  This is now detected 
and handled.

Regression tested on x86-64-linux-gnu.

OK to commit?

Regards,

Jerry


2008-08-10  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR fortran/35863
	* io.c (gfc_match_open): Enable UTF-8 in checks.
	* simplify.c (gfc_simplify_selected_char_kind): Enable iso_10646.

2008-08-10  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libfortran/35863
	* intrinsics/selected_char_kind.c: Enable iso_10646.
	* io/read.c (typedef uchar): New type.
	(read_utf8): New function to read a single UTF-8 encoded character.
	(read_utf8_char1): New function to read UTF-8 into a KIND=1 string.
	(read_default_char1): New functio to read default into KIND=1 string.
	(read_utf8_char4): New function to read UTF-8 into a KIND=4 string.
	(read_default_char4): New function to read UTF-8 into a KIND=4 string.
	(read_a): Modify to use the new functions.
	(read_a_char4): Modify to use the new functions.
	* io/write.c (error.h): Add include. (typedef uchar): New type.
	(write_default_char4): New function to default write KIND=4 string.
	(write_utf8_char4): New function to UTF-8 write KIND=4 string.
	(write_a_char4): Modify to use new functions.
	(write_character): Modify to use new functions.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: utf8-part1.1.diff
Type: text/x-patch
Size: 16665 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20080811/8be21be6/attachment.bin>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: utf8_1.f03
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20080811/8be21be6/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: utf8_2.f03
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20080811/8be21be6/attachment-0001.ksh>


More information about the Fortran mailing list