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

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

[Octave-bug-tracker] [bug #54893] using strrep with extended ASCII codes


From: Markus Mützel
Subject: [Octave-bug-tracker] [bug #54893] using strrep with extended ASCII codes inserts extra characters
Date: Thu, 25 Oct 2018 07:07:59 -0400 (EDT)
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:64.0) Gecko/20100101 Firefox/64.0

Update of bug #54893 (project octave):

                  Status:                    None => Invalid                
             Open/Closed:                    Open => Closed                 

    _______________________________________________________

Follow-up Comment #1:

This is expected behavior.
Octave (and most generally Linux as well) uses UTF-8. The degree symbol
consists of two bytes in UTF-8:

>> s1 = 'N43\302\26038''19.39"';

>> uint8 (s1)

ans =

   78   52   51  194  176   51   56   39   49   57   46   51   57   34


You are replacing only half of the bytes that make up the degree symbol. So
you are left with a non-interpretable byte that is shown by the character
replacement symbol.

The following does what you probably want:

strrep(s1, "\xC2\xB0", "\x3A")


Closing as invalid.


    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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