Skip to content

Commit d62b6f4

Browse files
docs/README-Unicode.md: Fix spelling and Markdown errors
Signed-off-by: Bernhard Kaindl <bernhard.kaindl@cloud.com>
1 parent 53c424f commit d62b6f4

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ repos:
9393
rev: v0.45.0
9494
hooks:
9595
- id: markdownlint
96+
exclude: docs/source/include-toplevel-*
9697

9798

9899
- repo: local

README-Unicode.md

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@
44

55
Python3.6 on XS8 does not have an all-encompassing default UTF-8 mode for I/O.
66

7-
Newer Python versions have an UTF-8 mode that they even enable by default.
8-
Python3.6 only enabled UTF-8 for I/O when an UTF-8 locale is used.
7+
Newer Python versions have a UTF-8 mode that they even enable by default.
8+
Python3.6 only enabled UTF-8 for I/O when a UTF-8 locale is used.
99
See below for more background info on the UTF-8 mode.
1010

1111
For situations where UTF-8 enabled, we have to specify UTF-8 explicitly.
1212

13-
Such sitation happens when LANG or LC_* variables are not set for UTF-8.
14-
XAPI plugins like auto-cert-kit find themself in this situation.
13+
This happens when LANG or LC_* variables are not set for UTF-8.
14+
XAPI plugins like auto-cert-kit find themselves in this situation.
1515

1616
Example:
1717
For reading UTF-8 files like the `pciids` file, add `encoding="utf-8"`.
18-
This applies especailly to `open()` and `Popen()` when files my contain UTF-8.
18+
This applies especially to `open()` and `Popen()` when files may contain UTF-8.
1919

20-
This also applies when en/decoding to/form `urllib` which uses bytes.
20+
This also applies when en/decoding to/from `urllib` which uses bytes.
2121
`urllib` has to use bytes as HTTP data can of course also be binary, e.g. compressed.
2222

2323
## Migrating `subprocess.Popen()`
@@ -95,7 +95,7 @@ for i in 2.7 3.{6,7};do echo "$i:";
9595
LC_ALL=C python$i -c 'open("/usr/share/hwdata/pci.ids").read()';done
9696
```
9797

98-
```
98+
```text
9999
2.7:
100100
3.6:
101101
Traceback (most recent call last):
@@ -106,7 +106,8 @@ UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 97850: ordi
106106
3.7:
107107
```
108108

109-
This error means that the `'ascii' codec` cannot handle input ord() >= 128, and as some Video cards use `²` to reference their power, the `ascii` codec chokes on them.
109+
This error means that the `'ascii' codec` cannot handle input `ord() >= 128`,
110+
and as some Video cards use `²` to reference their power, the `ascii` codec chokes on them.
110111

111112
It means `xcp.pci.PCIIds()` cannot use `open("/usr/share/hwdata/pci.ids").read()`.
112113

@@ -119,21 +120,22 @@ echo -e "\0262" # ISO-8859-1 for: "²"
119120
python3 -c 'open(".text").read()'
120121
```
121122

122-
```
123+
```text
123124
Traceback (most recent call last):
124125
File "<string>", line 1, in <module>
125126
File "<frozen codecs>", line 322, in decode
126127
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb2 in position 0: invalid start byte
127128
```
128129

129-
Of course, `xcp/net/ifrename` won't be affected but it would be good to fix the
130+
Of course, `xcp/net/ifrename` won't be affected, but it would be good to fix the
130131
warning for them as well in an intelligent way. See the proposal for that below.
131132

132133
There are a couple of possibilities and Python because 2.7 does not support the
133134
arguments we need to pass to ensure that all users of open() will work, we need
134135
to make passing the arguments conditional on Python >= 3.
135136

136-
1. Overriding `open()`, while technically working would not only affect xcp.python but the entire program:
137+
1. Overriding `open()`, while technically working would not only affect
138+
`xcp.compat` but the entire program:
137139

138140
```py
139141
if sys.version_info >= (3, 0):

0 commit comments

Comments
 (0)