Mercurial > octave
diff libinterp/corefcn/strfns.cc @ 25691:e866bb226d38 stable
Improve error message if iconv is not available (bug #54384).
* strfns.cc (__native2unicode__, __unicode2native__): More specific error
message if u8_conv_from_encoding fails with ENOSYS.
* native2unicode.m, unicode2native.m: Run BISTs conditionally on HAVE_ICONV.
(grafted from 5401dfadd2f6368e5432b5abef1516c29181ed76)
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Thu, 26 Jul 2018 19:52:28 +0200 |
parents | 6652d3823428 |
children | da077c5be8f2 |
line wrap: on
line diff
--- a/libinterp/corefcn/strfns.cc Fri Jul 27 07:00:05 2018 -0400 +++ b/libinterp/corefcn/strfns.cc Thu Jul 26 19:52:28 2018 +0200 @@ -767,8 +767,14 @@ utf8_str = octave_u8_conv_from_encoding (codepage, src, srclen, &length); if (! utf8_str) - error ("native2unicode: converting from codepage '%s' to UTF-8: %s", - codepage, std::strerror (errno)); + { + if (errno == ENOSYS) + error ("native2unicode: iconv() is not supported. Installing GNU " + "libiconv and then re-compiling Octave could fix this."); + else + error ("native2unicode: converting from codepage '%s' to UTF-8: %s", + codepage, std::strerror (errno)); + } frame.add_fcn (::free, static_cast<void *> (utf8_str)); @@ -813,8 +819,14 @@ native_bytes = octave_u8_conv_to_encoding (codepage, src, srclen, &length); if (! native_bytes) - error ("native2unicode: converting from UTF-8 to codepage '%s': %s", - codepage, std::strerror (errno)); + { + if (errno == ENOSYS) + error ("unicode2native: iconv() is not supported. Installing GNU " + "libiconv and then re-compiling Octave could fix this."); + else + error ("unicode2native: converting from UTF-8 to codepage '%s': %s", + codepage, std::strerror (errno)); + } frame.add_fcn (::free, static_cast<void *> (native_bytes));