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

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

[Octave-bug-tracker] [bug #52681] Bad reading for UTF-8 characters with


From: anonymous
Subject: [Octave-bug-tracker] [bug #52681] Bad reading for UTF-8 characters with fscanf()
Date: Sat, 16 Dec 2017 14:42:57 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36

URL:
  <http://savannah.gnu.org/bugs/?52681>

                 Summary: Bad reading for UTF-8 characters with fscanf()
                 Project: GNU Octave
            Submitted by: None
            Submitted on: Sat 16 Dec 2017 07:42:55 PM UTC
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Incorrect Result
                  Status: None
             Assigned to: None
         Originator Name: Santiago Higuera
        Originator Email: address@hidden
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 4.2.1
        Operating System: GNU/Linux

    _______________________________________________________

Details:

I'm trying to read some text files with Spanish characters, as ñ, ó and
others.

I don't know how to do it. I have tried with fscanf('%s'), but I get a warning
message:  'warning: range error for conversion to character value' 
I have prepared a sample file with utf-8 characters to explain my problem
using fscanf(fid,'%s'). The file can be downloaded from [1].

If I use fread(), it reads the correct byte value for extended characters, but
if I use fscanf(), I receive the message 'warning: range error for conversion
to character value', and the extended code characters are not read in the
result string. I can read the correct line if I use fgets() or fgetl(), but I
need single words to process the file and the same problem occurs with
sscanf(), if I try to read the words from a string variable.

I checked the problem in Matlab, and I have verified the Matlab can read the
correct characters from string with utf8 extended codes.

[1]  http://mercatorlab.com/p1.txt



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Sat 16 Dec 2017 07:42:55 PM UTC  Name: p1.txt  Size: 153B   By: None

<http://savannah.gnu.org/bugs/download.php?file_id=42661>

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?52681>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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