forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit8c49454
committed
Be more careful about extracting encoding from locale strings on Windows.
GetLocaleInfoEx() can fail on strings that setlocale() was perfectlyhappy with. A common way for that to happen is if the locale stringis actually a Unix-style string, say "et_EE.UTF-8". In that case,what's after the dot is an encoding name, not a Windows codepage number;blindly treating it as a codepage number led to failure, with a fairlysilly error message. Hence, check to see if what's after the dot isall digits, and if not, treat it as a literal encoding name rather thana codepage number. This will do the right thing with many Unix-stylelocale strings, and produce a more sensible error message otherwise.Somewhat independently of that, treat a zero (CP_ACP) result fromGetLocaleInfoEx() as meaning that we must use UTF-8 encoding.Back-patch to all supported branches.Juan José Santamaría FlechaDiscussion:https://postgr.es/m/24905.1585445371@sss.pgh.pa.us1 parent24566b3 commit8c49454
1 file changed
+24
-5
lines changedLines changed: 24 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
239 | 239 |
| |
240 | 240 |
| |
241 | 241 |
| |
242 |
| - | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
243 | 252 |
| |
244 | 253 |
| |
245 | 254 |
| |
246 | 255 |
| |
247 | 256 |
| |
248 |
| - | |
249 |
| - | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
250 | 264 |
| |
251 | 265 |
| |
252 | 266 |
| |
253 | 267 |
| |
254 |
| - | |
| 268 | + | |
255 | 269 |
| |
256 | 270 |
| |
257 | 271 |
| |
258 | 272 |
| |
259 | 273 |
| |
260 |
| - | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
261 | 280 |
| |
262 | 281 |
| |
263 | 282 |
| |
|
0 commit comments
Comments
(0)