Differences From Artifact [4bcce6446e]:
- File
src/OFString.m
— part of check-in
[d9eb7b50b3]
at
2017-01-07 00:37:26
on branch trunk
— Add of_ascii_{to{upper,lower},is{alpha,alnum}}
These are independent of the locale and work on the ASCII character set.
Unlike the C ones, these are 8-bit safe, meaning if a character > 0x7F
is passed, is{alpha,alnum} returns false and to{upper,lower} returns the
original character. (user: js, size: 58031) [annotate] [blame] [check-ins using]
To Artifact [2a34be912f]:
- File
src/OFString.m
— part of check-in
[6dff0f5922]
at
2017-01-07 02:34:39
on branch trunk
— Always use "." for the decimal point
This is achieved by replacing the locale's decimal point with "." after
formatting and replacing "." with the locale's decimal point before
parsing.To still use the decimal point from the locale for formatting, the new
flag "," is introduced to formats. This is useful for just printing a
string to the user that is not saved to a file or sent via a network.While this is an ugly hack, there is no better way to do this other than
implementing the functionality of printf and strtod myself, as POSIX
does not specify versions of these that take a locale as an argument.
While this is a lot of work and error-prone, I will most likely end up
doing this eventually.This commit also enables the locale in OFApplication to notice when
things break. As a nice side effect, ofhttp now uses the locale's
decimal point in its user interface. (user: js, size: 58336) [annotate] [blame] [check-ins using]
︙ | |||
26 27 28 29 30 31 32 33 34 35 36 37 38 39 | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | + | #import "OFString.h" #import "OFString_UTF8.h" #import "OFString_UTF8+Private.h" #import "OFArray.h" #import "OFDictionary.h" #import "OFDataArray.h" #import "OFSystemInfo.h" #ifdef OF_HAVE_FILES # import "OFFile.h" #endif #import "OFURL.h" #ifdef OF_HAVE_SOCKETS # import "OFHTTPClient.h" # import "OFHTTPRequest.h" |
︙ | |||
2331 2332 2333 2334 2335 2336 2337 | 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 | + - + + + | return value; } - (float)floatValue { void *pool = objc_autoreleasePoolPush(); OFString *decimalPoint = [OFSystemInfo decimalPoint]; |
︙ | |||
2357 2358 2359 2360 2361 2362 2363 | 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 | + - + + + | return value; } - (double)doubleValue { void *pool = objc_autoreleasePoolPush(); OFString *decimalPoint = [OFSystemInfo decimalPoint]; |
︙ |