summaryrefslogtreecommitdiff
path: root/libgfortran/io/write.c
diff options
context:
space:
mode:
Diffstat (limited to 'libgfortran/io/write.c')
-rw-r--r--libgfortran/io/write.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libgfortran/io/write.c b/libgfortran/io/write.c
index eccbe7e2a20..e17a3d86203 100644
--- a/libgfortran/io/write.c
+++ b/libgfortran/io/write.c
@@ -1835,7 +1835,10 @@ nml_write_obj (st_parameter_dt *dtp, namelist_info * obj, index_type offset,
break;
case BT_CHARACTER:
- write_character (dtp, p, 1, obj->string_length, DELIM);
+ if (dtp->u.p.current_unit->flags.encoding == ENCODING_UTF8)
+ write_character (dtp, p, 4, obj->string_length, DELIM);
+ else
+ write_character (dtp, p, 1, obj->string_length, DELIM);
break;
case BT_REAL: