When I tried to read the dbf file provided by the french land registry, I encountered a ParseFloatError on a Numeric field.
Any 'parcelles' shapefile available should reproduce this error.
I was able to narrow it down to the fact that when a Numeric field is a string padded with NUL bytes, the value.trim() call in field.rs:286 does not work (see playground).
This behavior is normal for Rust, but results in a ParseFloatError in dbase-rs.
Other dbf libraries do not seem to have this issue. This bug can be resolved by replacing the nul bytes by spaces, as pyshp does.
Should I open a PR ? If so, do you prefer to modify the read_string_of_len function, or should I create another one to read numeric strings ?
Note: this bug is likely to also happen with the Float field type, but I haven't tested it.
When I tried to read the dbf file provided by the french land registry, I encountered a ParseFloatError on a Numeric field. Any 'parcelles' shapefile available should reproduce this error.
I was able to narrow it down to the fact that when a Numeric field is a string padded with NUL bytes, the
value.trim()
call infield.rs:286
does not work (see playground).This behavior is normal for Rust, but results in a ParseFloatError in
dbase-rs
.Other dbf libraries do not seem to have this issue. This bug can be resolved by replacing the nul bytes by spaces, as pyshp does.
Should I open a PR ? If so, do you prefer to modify the
read_string_of_len
function, or should I create another one to read numeric strings ?Note: this bug is likely to also happen with the
Float
field type, but I haven't tested it.