diff --git a/src/DBFTables.jl b/src/DBFTables.jl index 53eda3c..8099084 100644 --- a/src/DBFTables.jl +++ b/src/DBFTables.jl @@ -192,8 +192,10 @@ end "Read a field descriptor from the stream, and create a FieldDescriptor struct" function read_dbf_field(io::IO) - field_name_raw = String(read!(io, Vector{UInt8}(undef, 11))) - field_name = Symbol(split(field_name_raw, '\0')[1]) + field_name_bytes = read(io, 11) + i = findfirst(iszero, field_name_bytes) + n = i === nothing ? 11 : i - 1 + field_name = Symbol(field_name_bytes[1:n]) field_type = read(io, Char) skip(io, 4) # skip field_len = read(io, UInt8)