2 ! { dg-options "-fbackslash" }
3 ! Contributed by Jerry DeLisle <jvdelisle@gcc.gnu.org>
6 integer, parameter :: k4 = 4
7 character(kind=4, len=30) :: string1, string2
8 character(kind=1, len=30) :: string3
9 string1 = k4_"This is Greek: \u039f\u03cd\u03c7\u03af"
10 string2 = k4_"Jerry in Japanese is: \u30b8\u30a8\u30ea\u30fc"
11 open(10, encoding="utf-8", status="scratch")
12 write(10,'(a)') trim(string1)
17 string3 = "abcdefghijklmnopqrstuvwxyz"
18 read(10,'(a)') string1
19 read(10,'(a)') string2
20 if (string1 /= k4_"This is Greek: \u039f\u03cd\u03c7\u03af") STOP 1
21 if (len(trim(string1)) /= 20) STOP 2
22 if (string2 /= k4_" Jerry in Japanese is: \u30b8\u30a8\u30ea\u30fc")&
24 if (len(string2) /= 30) STOP 4
26 read(10,'(a)') string3
27 if (string3 /= "This is Greek: ????") STOP 5
29 ! The following examples require UTF-8 enabled editor to see correctly.
30 ! ジエリー Sample of Japanese characters.
31 ! Οὐχὶ Sample of Greek characters.