-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
QGIS reads shp with 11 character attribute header #58152
Comments
The DBF format uses 11 bytes to store a I don't think this is actually an issue. Anyway the OGR provider sanitizes the fields name to 10 characters max when exporting to the ESRI Shapefile format. |
Yes, this is the intended behavior. Cf following constants of the shapelib library:
|
Thank you @rouault . Do you know why this choice was made, to object only to one character and not, for example, 3? |
Answered by @agiudiceandrea in #58152 (comment) |
Thank you. We could introduce an additional check during reading. If the eleventh byte is a null character (\0), treat it as the standard terminator. Otherwise, raise an error indicating that the field name is not correctly terminated. What do you think about |
The field name is encoded on 11 bytes: not less, not more. So it is nominally 10 characters or less + a \0 terminator (or the non-standard situation of 11 characters without a \0 terminator) |
Please don't hate me: and why was it decided here that the software must accept a nonstandard situation, since it is easily mapped as wrong? |
I don't know. Probably the common logic: "be lax on reading, and strict on writing". This dates back to the initial revision of shapelib 29 years ago: OSGeo/shapelib@4af7724#diff-dad95b297ecd1ec47ff997ebfc36e4be7104f688b01954f704f0393a58ba5e09R543 |
But if it is 12 characters is it always lax on reading? 🙃 Okay, I'll stop here. For me it is something that should be changed, because the case is left open and it fits, because it may be 10 or 11, for the reasons said, but it is not mapped correctly. Thank you for your time |
Thanks @agiudiceandrea for the reply and thanks @rouault for your time and thanks @aborruso for the time you wasted (it's wasted at this point) |
It means there'll be no action taken |
What is the bug or the crash?
A colleague created, using matlab, an empty shapefile (only with one line with NULL attributes) and with an attribute with a header with 11 characters (consistency)
QGIS reads it and also allows you to add features, while ArcGIS PRO reads it but truncates the header at the tenth character.
I'm reporting this because it could be a bug!
Steps to reproduce the issue
Versions
OSGeo4W QGIS 3.34.8
Supported QGIS version
New profile
Additional context
header11.zip
The text was updated successfully, but these errors were encountered: