Hi,

I found a problem in reading the file "channel 1 20120815 015005 00001.ddf" 
that I attached to this message.
The file is the output from a measurement equipment and basically contains 
some text but has extension '.ddf'.
I tried to read the content of the file with the following lines of code:

f = open(filename,"r")
readall(filename)

But I get the following error when julia attempts to read the unicode 
character °

Error showing value of type UTF8String:
ERROR: UnicodeError: invalid character index
in next at ./unicode/utf8.jl:65
 in print_escaped at strings/io.jl:114
 in print_quoted at strings/io.jl:131
 in show at strings/io.jl:48
 in anonymous at show.jl:1294
 in with_output_limit at ./show.jl:1271
 in showlimited at show.jl:1293
 in writemime at replutil.jl:4
 in display at REPL.jl:114
 in display at REPL.jl:117
 [inlined code] from multimedia.jl:151
 in display at multimedia.jl:162
 in print_response at REPL.jl:134
 in print_response at REPL.jl:121
 in anonymous at REPL.jl:624
 in run_interface at ./LineEdit.jl:1610
 in run_frontend at ./REPL.jl:863
 in run_repl at ./REPL.jl:167
 in _start at ./client.jl:420


I did some tests to understand more this problem:
1. I copied the content of the original .ddf file to a new file with the 
same name and extension, and I ran the julia code f = open(filename,"r"); 
readall(filename). It worked! 
2. I removed the unicode character ° from the original .ddf file and I ran 
the julia code f = open(filename,"r"); readall(filename)  successfully.
3. I tried to read the original .ddf file using python with f = 
open(filename,"r"); f.read() and it worked.

It seems like Julia can read files containing unicode characters, but for 
some reasons it cannot read the specific files that are generated by this 
measurement equipment. The same problem doesn't happen in python.

Does anybody have some ideas regarding this problem?
Many thanks,

Alberto

Attachment: channel 1 20120815 015005 00001.ddf
Description: Binary data

Reply via email to