You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using this method the conversion from string to enum is done automatically.
@@ -1454,10 +1457,16 @@ changes to the user's data, and since version 3.1 PyShp no longer does this.
1454
1457
False
1455
1458
1456
1459
### PyShp's approach
1457
-
The simplest most robust solution to support arbitrary codec encoding as ascii bytes, is probably to encode those
1458
-
bytes as Base64 (with an alphabet excluding dbf pad bytes), and then encode that Base64 string a third time as bytes.
1459
-
PyShp tries to be a little easier to use than this. The intention is to adhere to [Postel's Law](https://en.wikipedia.org/wiki/Robustness_principle) so hopefully PyShp is still fairly lenient when decoding and reading Shapefiles, but either informative or
1460
-
stricter, when the user attempts to encoding or write invalid files.
1460
+
The simplest, most robust solution to store arbitrary codec encodings as ascii bytes, is probably to encode those
1461
+
encodings as Base64 (with an alphabet excluding dbf pad bytes), and then encode that Base64 string a third time as Ascii bytes.
1462
+
PyShp tries to be a little easier to use than this. The intention is to adhere to [Postel's Law](https://en.wikipedia.org/wiki/Robustness_principle) so hopefully PyShp is still fairly lenient when decoding and reading Shapefiles. But either informative or
1463
+
stricter, when the user attempts to encode or write potentially invalid text data.
1464
+
#### UTF-8 and Single byte codecs
1465
+
UTF-8 is backwards compatible with ascii, and so far (as we know), is only known to be affected by Problem 4.
1466
+
PyShp a provides a faster 'happy' path for Writers and DbfWriters using "utf8" (the default), and when text
1467
+
field values are known to have been encoded, each code point to a single byte. Otherwise, a more robust
1468
+
strategy is used, to handle the trickier codecs, to hopefully correctly encode data as far as possible,
1469
+
otherwise to raise a warning or error.
1461
1470
#### Warnings
1462
1471
When possible data corruption is detected when reading or writing a Shapefile (or dbf file), by default
1463
1472
PyShp will raise a warning. Supported situations are listed below under Decoding and Encoding.
0 commit comments