Unicode related error when reading a .csv

I’ve run into this a few times: Readdlm: ignore_invalid_chars option does not exist anymore. There used to be the very helpful option ignore_invalid_chars in dlmread: https://docs.julialang.org/en/release-0.4/stdlib/io-network/ which magically handled my issues. I in my case CSV.jl did work though.

Also note that copy-paste into a gist likely removes the offending characters. I had to push to the gist linked in my post to get the offending character there.

Anyway, here for you to try at home:

/tmp >> git  clone git@gist.github.com:8bf1448cf05356458710c02572722c88.git
Cloning into '8bf1448cf05356458710c02572722c88'...
remote: Counting objects: 6, done.
remote: Total 6 (delta 0), reused 0 (delta 0), pack-reused 6
Receiving objects: 100% (6/6), done.
Resolving deltas: 100% (1/1), done.
/tmp >> cd 8bf1448cf05356458710c02572722c88 
/tmp/8bf1448cf05356458710c02572722c88(master)  >> julia
               _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: https://docs.julialang.org
   _ _   _| |_  __ _   |  Type "?help" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.6.1 (2017-10-24 22:15 UTC)
 _/ |\__'_|_|_|\__'_|  |  
|__/                   |  x86_64-pc-linux-gnu

julia> readdlm("txt")
ERROR: at row 2, column 3 : UnicodeError: invalid character index)
Stacktrace:
 [1] dlm_parse(::String, ::Char, ::Char, ::Char, ::Char, ::Bool, ::Bool, ::Bool, ::Int64, ::Bool, ::Base.DataFmt.DLMOffsets) at ./datafmt.jl:610
 [2] readdlm_string(::String, ::Char, ::Type, ::Char, ::Bool, ::Dict{Symbol,Union{Char, Integer, Tuple{Integer,Integer}}}) at ./datafmt.jl:343
 [3] #readdlm_auto#11(::Array{Any,1}, ::Function, ::String, ::Char, ::Type{T} where T, ::Char, ::Bool) at ./datafmt.jl:132
 [4] #readdlm#7 at ./datafmt.jl:81 [inlined]
 [5] readdlm(::String, ::Char, ::Char) at ./datafmt.jl:81
 [6] #readdlm#5(::Array{Any,1}, ::Function, ::String) at ./datafmt.jl:64
 [7] readdlm(::String) at ./datafmt.jl:64

julia> using CSV
WARNING: Method definition ==(Base.Nullable{S}, Base.Nullable{T}) in module Base at nullable.jl:238 overwritten in module NullableArrays at /home/mauro/.julia/v0.6/NullableArrays/src/operators.jl:99.

julia> CSV.read("txt")
5×1 DataFrames.DataFrame
│ Row │ Device;Device serial;ID;Date/Time;Value;Unit;Mode;Value2;Unit2;Mode2;Measurement;Calibration;Additional;Sensor;Sensor serial;User    │
├─────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ 1   │ "Multi 3630; 16231200;2;30.08.2016 15:57:11;0.1;µS/cm;Cond;22.6;°C;Temp;;;C = 0.475 1/cm   Tref25   nLF;TetraCon 925-P; 16201701;" │
│ 2   │ "Multi 3630; 16231200;2;30.08.2016 15:57:11;0.1;µS/cm;Cond;22.6;°C;Temp;;;C = 0.475 1/cm   Tref25   nLF;TetraCon 925-P; 16201701;" │
│ 3   │ "Multi 3630; 16231200;2;30.08.2016 15:57:12;0.1;µS/cm;Cond;22.6;°C;Temp;;;C = 0.475 1/cm   Tref25   nLF;TetraCon 925-P; 16201701;" │
│ 4   │ "Multi 3630; 16231200;2;30.08.2016 15:57:13;0.1;µS/cm;Cond;22.6;°C;Temp;;;C = 0.475 1/cm   Tref25   nLF;TetraCon 925-P; 16201701;" │
│ 5   │ "Multi 3630; 16231200;2;30.08.2016 15:57:14;0.1;µS/cm;Cond;22.6;°C;Temp;;;C = 0.475 1/cm   Tref25   nLF;TetraCon 925-P; 16201701;" │

julia> 

Edit: there is also uCSV.jl to try.