octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #56805] Using unrecognized char in text result


From: Rik
Subject: [Octave-bug-tracker] [bug #56805] Using unrecognized char in text results in infinite warning loop
Date: Tue, 3 Sep 2019 12:41:04 -0400 (EDT)
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko

Follow-up Comment #6, bug #56805 (project octave):

Seems like there might be a couple things to debug here.

First, the m-file has this input validation,


  if (! ischar (codepage))
    error ("native2unicode: CODEPAGE must be a string")
  endif


The internal C++ function __native2unicode__ in strfns.cc also has


  std::string tmp = args(1).xstring_value ("CODEPAGE must be a string");


In general, we only want to do input validation once for efficiency which
usually means the m-file.  The internal function, as signified by the leading
"__", expects to be called in the proper way since it should never be reached
accidentally.

Second, I ran 


x = native2unicode(169, 'latin1')


in Matlab and get just a scalar ([169]) in return.  Is that correct that
Octave does not produce the same output as Matlab for the same input?  It may
be because they use UTF-16 encoding natively, I believe.

Third, the internal function always returns a row vector.  Hence, I think
you're right that you want to test for "! isrow (native_bytes)" and only
transpose if that turns out to be true.


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?56805>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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