[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #55826] Wrong encoding of files generated by c

From: Markus Mützel
Subject: [Octave-bug-tracker] [bug #55826] Wrong encoding of files generated by code (fopen fprints fclose)
Date: Mon, 4 Mar 2019 13:58:51 -0500 (EST)
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0

Follow-up Comment #1, bug #55826 (project octave):

Octave is in the process of better supporting international scripts in all
parts of its code. As part of that process, the internal representation of
char arrays has changed to be consistently in UTF-8.
So even if you are using .m files that are encoded in Windows-1252, the
resulting strings are internally UTF-8.

If you want to write in a specific encoding, you would have to convert the
strings to that encoding before writing to the file:

fid = fopen('test.txt', 'w');
fprintf(fid, "%s\n", unicode2native('Décompte', 'Windows-1252'));
f_error = fclose(fid);

In a future version of Octave, you'll be able to specify an encoding when
opening a file:

fid = fopen('test.txt', 'w', 'n', 'Windows-1252');

That might also default to the system encoding on Windows (or to UTF-8).


Reply to this item at:


  Message sent via Savannah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]