Mercurial > octave
diff liboctave/wrappers/uniconv-wrappers.c @ 32023:bce1850f8104
gui: Use iconv/gnulib to load editor content from files in any encoding.
* bootstrap.conf: Add module "uniconv/u16-conv-from-enc".
* liboctave/wrappers/uniconv-wrappers.c, liboctave/wrappers/uniconv-wrappers.h
(octave_u16_conv_from_encoding, octave_u16_conv_from_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: Remove header that is no longer needed.
* libgui/src/m-editor/file-editor-tab.cc
(octave::file_editor_tab::load_file): Use iconv/gnulib functions to load file
editor content from file in any encoding. The interpreter needs to be able to
read these files using the iconv/gnulib functions anyway. And Qt6 can only
convert from UTF-8, UTF-16, UTF-32 or the system locale encoding.
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Sat, 15 Apr 2023 20:51:50 +0200 |
parents | da2954782945 |
children | 24752aa8be11 |
line wrap: on
line diff
--- a/liboctave/wrappers/uniconv-wrappers.c Sat Apr 15 07:17:15 2023 -0700 +++ b/liboctave/wrappers/uniconv-wrappers.c Sat Apr 15 20:51:50 2023 +0200 @@ -92,6 +92,22 @@ src, srclen, NULL, lengthp); } +uint16_t * +octave_u16_conv_from_encoding (const char *fromcode, const char *src, + size_t srclen, size_t *lengthp) +{ + return u16_conv_from_encoding (fromcode, iconveh_question_mark, + src, srclen, NULL, NULL, lengthp); +} + +uint16_t * +octave_u16_conv_from_encoding_strict (const char *fromcode, const char *src, + size_t srclen, size_t *lengthp) +{ + return u16_conv_from_encoding (fromcode, iconveh_error, + src, srclen, NULL, NULL, lengthp); +} + char * octave_u16_conv_to_encoding (const char *tocode, const uint16_t *src, size_t srclen, size_t *lengthp)