Mercurial > octave
diff liboctave/wrappers/uniconv-wrappers.c @ 32021:da2954782945
gui: Use iconv/gnulib to save editor content in non-UTF-8.
* bootstrap.conf: Add module "uniconv/u16-conv-to-enc".
* liboctave/wrappers/uniconv-wrappers.c, liboctave/wrappers/uniconv-wrappers.h
(octave_u16_conv_to_encoding, octave_u16_conv_to_encoding_strict): Add wrappers
for gnulib function.
* liboctave/util/oct-string.cc, liboctave/util/oct-string.h
(octave::string::u16_to_encoding): Add new function.
* libgui/src/m-editor/file-editor-tab.h
(octave::file_editor_tab::check_valid_codec): Change return type of function.
* libgui/src/m-editor/file-editor-tab.cc
(octave::file_editor_tab::do_save_file): Use iconv/gnulib functions to save
file editor content in non-UTF-8 encoding. The interpreter needs to be able to
read these files using the iconv/gnulib functions anyway. And Qt6 can only
convert to UTF-8, UTF-16, UTF-32 or the system locale encoding.
(octave::file_editor_tab::check_valid_codec): Use iconv/gnulib facilities to
check if selected encoding is valid for file editor content.
(octave::file_editor_tab::save_file): Adjust for changed return type of
check_valid_codec.
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Sat, 15 Apr 2023 11:29:15 +0200 |
parents | 470134b3fc28 |
children | bce1850f8104 |
line wrap: on
line diff
--- a/liboctave/wrappers/uniconv-wrappers.c Fri Apr 14 21:24:06 2023 -0400 +++ b/liboctave/wrappers/uniconv-wrappers.c Sat Apr 15 11:29:15 2023 +0200 @@ -93,6 +93,22 @@ } char * +octave_u16_conv_to_encoding (const char *tocode, const uint16_t *src, + size_t srclen, size_t *lengthp) +{ + return u16_conv_to_encoding (tocode, iconveh_question_mark, + src, srclen, NULL, NULL, lengthp); +} + +char * +octave_u16_conv_to_encoding_strict (const char *tocode, const uint16_t *src, + size_t srclen, size_t *lengthp) +{ + return u16_conv_to_encoding (tocode, iconveh_error, + src, srclen, NULL, NULL, lengthp); +} + +char * octave_u32_conv_to_encoding_strict (const char *tocode, const uint32_t *src, size_t srclen, size_t *lengthp) {