@@ -121,6 +121,7 @@ julia_type(::Val{'O'}, ndec::UInt8) = Float64
121121julia_type (:: Val{'I'} , ndec:: UInt8 ) = Int32
122122julia_type (:: Val{'+'} , ndec:: UInt8 ) = Int64
123123julia_type (:: Val{'L'} , ndec:: UInt8 ) = Bool
124+ julia_type (:: Val{'M'} , ndec:: UInt8 ) = String
124125function julia_type (:: Val{T} , ndec:: UInt8 ) where {T}
125126 @warn " Unknown DBF type code '$T '. Data will be loaded as `String"
126127 String
@@ -129,10 +130,13 @@ end
129130
130131julia_value (o:: FieldDescriptor , s:: AbstractString ) = julia_value (o. type, Val (o. dbf_type), s:: AbstractString )
131132
132- function julia_value ( :: Type{String} , :: Val{'C'} , s:: AbstractString )
133+ function julia_value_string ( s:: AbstractString )
133134 s2 = strip (s)
134135 isempty (s2) ? missing : String (s2)
135136end
137+
138+ julia_value (:: Type{String} , :: Val{'C'} , s:: AbstractString ) = julia_value_string (s)
139+ julia_value (:: Type{String} , :: Val{'M'} , s:: AbstractString ) = julia_value_string (s)
136140function julia_value (:: Type{Date} , :: Val{'D'} , s:: AbstractString )
137141 all (isspace, s) ? missing : Date (s, dateformat " yyyymmdd" )
138142end
@@ -163,10 +167,13 @@ function julia_value(::Type{Int64}, ::Val{'+'}, s::AbstractString)
163167end
164168function julia_value (:: Type{Bool} , :: Val{'L'} , s:: AbstractString )
165169 char = only (s)
166- char === ' ?' ? missing :
167- char in " YyTt" ? true :
168- char in " NnFf" ? false :
169- error (" Unknown logical entry for dbf type code 'L': '$char '." )
170+ if char in " YyTt"
171+ return true
172+ elseif char in " NnFf"
173+ return false
174+ else
175+ return missing
176+ end
170177end
171178
172179" Read a field descriptor from the stream, and create a FieldDescriptor struct"
0 commit comments