Commit 1b7d5c8
committed
bug symfony#61242 [Console] [Table] Fix invalid UTF-8 due to text wrapping (schlndh)
This PR was merged into the 6.4 branch.
Discussion
----------
[Console] [Table] Fix invalid UTF-8 due to text wrapping
| Q | A
| ------------- | ---
| Branch? | 6.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Issues | Fix symfony#58286
| License | MIT
I changed the `OutputFormatter` to use string methods from `Helper` to avoid splitting multi-byte UTF-8 characters and causing the "Invalid UTF-8" exception as a result. Unfortunately, it turns out that `Helper::length` and `Helper::substr` are not mutually compatible for UTF-8, because `length` returns the length in graphemes, while `substr` worked with characters. I decided to fix that, which is technically a BC break (hopefully not too severe). I considered making a private fixed copy of the method, but that just seemed weird.
Commits
-------
218ca62 [Console][Table] Fix invalid UTF-8 due to text wrappingFile tree
3 files changed
+17
-6
lines changed- src/Symfony/Component/Console
- Formatter
- Helper
- Tests/Formatter
3 files changed
+17
-6
lines changedLines changed: 9 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
146 | 147 | | |
147 | 148 | | |
148 | 149 | | |
| 150 | + | |
| 151 | + | |
149 | 152 | | |
150 | | - | |
151 | | - | |
| 153 | + | |
| 154 | + | |
152 | 155 | | |
153 | 156 | | |
154 | 157 | | |
| |||
169 | 172 | | |
170 | 173 | | |
171 | 174 | | |
172 | | - | |
| 175 | + | |
173 | 176 | | |
174 | 177 | | |
175 | 178 | | |
| |||
236 | 239 | | |
237 | 240 | | |
238 | 241 | | |
239 | | - | |
240 | | - | |
| 242 | + | |
| 243 | + | |
241 | 244 | | |
242 | 245 | | |
243 | 246 | | |
| |||
253 | 256 | | |
254 | 257 | | |
255 | 258 | | |
256 | | - | |
| 259 | + | |
257 | 260 | | |
258 | 261 | | |
259 | 262 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
89 | 93 | | |
90 | 94 | | |
91 | 95 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
365 | 365 | | |
366 | 366 | | |
367 | 367 | | |
| 368 | + | |
| 369 | + | |
368 | 370 | | |
369 | 371 | | |
370 | 372 | | |
| |||
376 | 378 | | |
377 | 379 | | |
378 | 380 | | |
| 381 | + | |
| 382 | + | |
379 | 383 | | |
380 | 384 | | |
381 | 385 | | |
| |||
0 commit comments