Commit 5c63521
committed
File.dirname: add a spec for Shift JIS handling
While trying to speedup various `File.*` methods, I realized they
were way slower and complicated than they should for no apparent
reason. However after asking Nobu he explained that Shift JIS encoded
text can contain `0x5C` (ASCII backslash) as the second byte of a
two byte character sequence.
Since on Windows `0x5C` is `File::ALT_SEPARATOR`, this can easily
break naive path related algorithms searching for directory separators.1 parent 2a98670 commit 5c63521
1 file changed
Lines changed: 29 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
81 | 103 | | |
82 | 104 | | |
83 | 105 | | |
| |||
98 | 120 | | |
99 | 121 | | |
100 | 122 | | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
101 | 130 | | |
102 | 131 | | |
103 | 132 | | |
| |||
0 commit comments