public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/45179] New: Support UTF-8 (and other encodings) in the source file (.f90) for CHARACTER(kind=4)
@ 2010-08-04 10:16 burnus at gcc dot gnu dot org
2010-08-04 10:19 ` [Bug fortran/45179] " burnus at gcc dot gnu dot org
2010-08-04 12:39 ` burnus at gcc dot gnu dot org
0 siblings, 2 replies; 4+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-08-04 10:16 UTC (permalink / raw)
To: gcc-bugs
libcpp allows one to directly input non-ascii characters in source files (.f90
etc.); the used encoding can be set using the options:
-finput-charset=UTF-8
Cf. also: -fexec-charset and -fwide-exec-charset
and http://gcc.gnu.org/onlinedocs/gcc/Preprocessor-Options.html
If one uses gfortran -cpp -finput-charset=UTF-8 wide.f90
one currently gets the error:
f951: warning: command line option "-finput-charset=UTF-8" is valid for
C/C++/ObjC/ObjC++ but not for Fortran [enabled by default]
The files scanner.c etc. do support the reading of wide chars thus, in
principle, only few changes should be required.
Caveat: Many people still use kind=1 strings - but with non-ASCII characters;
one should try to make sure that this continues to work. Stuffing the
characters in as one currently does is one option. For Latin1 (ISO 8859-1)
characters one can also simply strip off the high bytes and write only the
first byte. Using UTF-8 also works - though len() will report too many
characters.
--
Summary: Support UTF-8 (and other encodings) in the source file
(.f90) for CHARACTER(kind=4)
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: burnus at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45179
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/45179] Support UTF-8 (and other encodings) in the source file (.f90) for CHARACTER(kind=4)
2010-08-04 10:16 [Bug fortran/45179] New: Support UTF-8 (and other encodings) in the source file (.f90) for CHARACTER(kind=4) burnus at gcc dot gnu dot org
@ 2010-08-04 10:19 ` burnus at gcc dot gnu dot org
2010-08-04 12:39 ` burnus at gcc dot gnu dot org
1 sibling, 0 replies; 4+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-08-04 10:19 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from burnus at gcc dot gnu dot org 2010-08-04 10:19 -------
Created an attachment (id=21392)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21392&action=view)
Test case in UTF-8 encoding
Compile with:
gfortran -cpp -finput-charset=UTF-8 wide.f90
Expected output:
Hello World = 你好
你好
Currently, the second line is wrong; the two Chinese characters Ni (you) and
Hao (good) [ni hao = hello, good morning/afternoon] are split into six one-byte
characters as len() shows.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45179
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/45179] Support UTF-8 (and other encodings) in the source file (.f90) for CHARACTER(kind=4)
2010-08-04 10:16 [Bug fortran/45179] New: Support UTF-8 (and other encodings) in the source file (.f90) for CHARACTER(kind=4) burnus at gcc dot gnu dot org
2010-08-04 10:19 ` [Bug fortran/45179] " burnus at gcc dot gnu dot org
@ 2010-08-04 12:39 ` burnus at gcc dot gnu dot org
1 sibling, 0 replies; 4+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-08-04 12:39 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from burnus at gcc dot gnu dot org 2010-08-04 12:39 -------
Created an attachment (id=21393)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21393&action=view)
Support -finput-charset= (accepts option, but does not fix the issue)
This patch allows the -finput-charset= but it does not fix the actual problem.
scanner.c has: load_line, which works with wide strings, but gets the letters
via getc(). Maybe one could implement UTF-8 reading for strings in scanner.c -
and use libcpp (-cpp) to convert the input encoding to UTF-8, if it isn't
UTF-8.
http://gcc.gnu.org/git/?p=gcc.git;a=blob;f=libgfortran/io/read.c;hb=HEAD#l236
If one uses CPP, one probably needs to set (internally) wide_charset to UTF-8
such that CPP outputs UTF-8.
Possible work plan:
a) if -finput-charset= is used but CPP is not used: Allow UTF-8 but print an
error for other encodings. Read internally as UTF-8.
b) if -finput-charset= is used with -cpp: Allow it and set exec encoding (or
whatever it is called) to UTF-8 such that libcpp returns an UTF-8 string to
gfortran
c) By default continue to use the current means of input, i.e. a simple getc.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45179
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/45179] Support UTF-8 (and other encodings) in the source file (.f90) for CHARACTER(kind=4)
[not found] <bug-45179-4@http.gcc.gnu.org/bugzilla/>
@ 2014-05-04 14:14 ` dominiq at lps dot ens.fr
0 siblings, 0 replies; 4+ messages in thread
From: dominiq at lps dot ens.fr @ 2014-05-04 14:14 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45179
Dominique d'Humieres <dominiq at lps dot ens.fr> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2014-05-04
Ever confirmed|0 |1
--- Comment #3 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Still present at r210049.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-05-04 14:14 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-04 10:16 [Bug fortran/45179] New: Support UTF-8 (and other encodings) in the source file (.f90) for CHARACTER(kind=4) burnus at gcc dot gnu dot org
2010-08-04 10:19 ` [Bug fortran/45179] " burnus at gcc dot gnu dot org
2010-08-04 12:39 ` burnus at gcc dot gnu dot org
[not found] <bug-45179-4@http.gcc.gnu.org/bugzilla/>
2014-05-04 14:14 ` dominiq at lps dot ens.fr
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).