Skip to content

Commit 493534a

Browse files
authored
Merge pull request #422 from JamesParrott/Trim_strings_wrt_code_points_not_bytes
v3.1.0 Strict mode. Robuster support for unicode inc bug fixes.
2 parents 53a923d + e039403 commit 493534a

6 files changed

Lines changed: 379 additions & 111 deletions

File tree

README.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,32 @@ part of your geospatial project.
9393

9494
# Version Changes
9595

96-
## 3.0.14.dev
96+
## 3.1.0
97+
### Unicode support made more robust and encoding bugs fixed
98+
- Truncation of field names and text fields now respects unicode code point boundaries (fixes issues -
99+
416 and 148).
100+
- Warnings raised if truncation, or replacing b" " with b"_" would corrupt encoded field names, -
101+
both if they would either be undecodable, or would silently decode to incorrect data (warns users
102+
if issue 421 applies).
103+
- Correctly truncated field names are now stored in field instances, as would actually be seen in the file.
104+
- New strict mode. Writer(strict=True) raises errors or refuse to create fields and text records with data that -
105+
would be truncated or cannot be correctly decoded back again by PyShp, exactly as given by the user.
106+
- In strict mode, ascii spaces in encoded names are no longer replaced by ascii underscores at all
107+
(work around to avoid corrupting unicode field names - provides opt-in fix for issue 421).
108+
- BREAKING. When reading .dbf files, Trailing ascii spaces in text fields before a null terminator char (in the -
109+
decoded string) is now removed (i.e. instead of .strip().rstrip('\x00') we now do: .rstrip("\x00").rstrip(" ")).
110+
- BREAKING. Enclosing Whitespace other than trailing ascii spaces (0x20) after null chars in text fields is now -
111+
preserved, when reading .dbf files (fixes issue 418 - James feels this was a bug. Let him know if you think otherwise).
112+
- BREAKING Trailing null chars other than null terminators & null padding bytes, followed by whitespace other than
113+
ascii spaces, are now preserved.
114+
- Writing dbf records is now atomic.
115+
97116
### ShpWriter.shape API Tweak (small breaking change).
98117
- Make ShpWriter.shape return shape length in bytes (the
99118
same as for offset) not in 16 bit words.
100119
### Testing
101120
- Include NullShapes in shp round trip test.
121+
- En/decoding of Dbf files and Fields round trips correctly.
102122

103123

104124
## 3.0.13

changelog.txt

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,27 @@
1-
VERSION 3.0.14.dev
1+
VERSION 3.1.0
2+
3+
2026-06-23
4+
Unicode support made more robust and encoding bugs fixed
5+
* Truncation of field names and text fields now respects unicode code point boundaries (fixes issues
6+
416 and 148).
7+
* Warnings raised if truncation, or replacing b" " with b"_" would corrupt encoded field names,
8+
both if they would either be undecodable, or would silently decode to incorrect data (warns users
9+
if issue 421 applies).
10+
* Correctly truncated field names are now stored in field instances, as would actually be seen in the file.
11+
* New strict mode. Writer(strict=True) raises errors or refuse to create fields and text records with data that
12+
would be truncated or cannot be correctly decoded back again by PyShp, exactly as given by the user.
13+
* In strict mode, ascii spaces in encoded names are no longer replaced by ascii underscores at all
14+
(work around to avoid corrupting unicode field names - provides opt-in fix for issue 421)
15+
* BREAKING. When reading .dbf files, Trailing ascii spaces in text fields before a null terminator char (in the
16+
decoded string) is now removed (i.e. instead of .strip().rstrip('\x00') we now do: .rstrip("\x00").rstrip(" ")).
17+
* BREAKING. Enclosing Whitespace other than trailing ascii spaces (0x20) after null chars in text fields is now
18+
preserved, when reading .dbf files (fixes issue 418 - James feels this was a bug. Let him know if you think otherwise).
19+
* BREAKING Trailing null chars other than null terminators & null padding bytes, followed by whitespace other than
20+
ascii spaces, are now preserved
21+
* Writing dbf records is now atomic.
22+
Testing.
23+
* En/decoding of Dbf files and Fields round trips correctly.
24+
225

326
2026-06-20
427
* API Tweak (small breaking change). Make ShpWriter.shape return shape length in bytes

0 commit comments

Comments
 (0)