locale

Error: “unsupported locale setting” on Python / OSX

断了今生、忘了曾经 提交于 2021-02-09 20:43:54
问题 I've got the following error trying to run a local Python scriot on OSX Lion 10.7: You are using the base settings file. You are advised to create a local.py file (based on local_sample.py) with your personal settings. Traceback (most recent call last): File "manage.py", line 39, in <module> detect_port(sys.argv) File "manage.py", line 22, in detect_port default_port = getattr(settings, 'RUNSERVER_PORT', None) File "/Library/Python/2.7/site-packages/django/conf/__init__.py", line 53, in _

Error: “unsupported locale setting” on Python / OSX

岁酱吖の 提交于 2021-02-09 20:43:38
问题 I've got the following error trying to run a local Python scriot on OSX Lion 10.7: You are using the base settings file. You are advised to create a local.py file (based on local_sample.py) with your personal settings. Traceback (most recent call last): File "manage.py", line 39, in <module> detect_port(sys.argv) File "manage.py", line 22, in detect_port default_port = getattr(settings, 'RUNSERVER_PORT', None) File "/Library/Python/2.7/site-packages/django/conf/__init__.py", line 53, in _

C++11: is std::locale::empty() even a thing?

给你一囗甜甜゛ 提交于 2021-02-08 16:54:45
问题 Trying to compile some code from StackOverflow, basically, these lines: std::wifstream wif(filename); wif.imbue(std::locale(std::locale::empty(), new std::codecvt_utf8<wchar_t>)); GCC version: gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 I get a compile error: 'empty' is not a member of 'std::locale' And I agree with the compiler, checked with documentation like cppreference - there is no info about such thing. Header files as well do not show anything. I wonder, if this is just me or the sample

UnicodeEncodeError: 'gbk' codec can't encode character '\ue13b' in position 25: illegal multibyte sequence

折月煮酒 提交于 2021-02-08 05:35:55
问题 Error : UnicodeEncodeError: 'gbk' codec can't encode character '\ue13b' in position 25: illegal multibyte sequence The file encoding format is utf-8, and there is an unrecognized word in the file when it is read. ‘左足趾麻木’ Code : for line in open(label_filepath, encoding='utf-8'): print(line) 回答1: The error is happening when Python tries to print. When printing, that is writing to sys.stdout, Python encodes the text to be printed with the encoding expected by the terminal. In this case the

Boolean values in local language

霸气de小男生 提交于 2021-02-07 12:40:42
问题 This question has been asked long time ago on serverfault but no working awnser. I'm hoping somebody has encountered it and found a solution since then. Example: <% Response.Write True Response.Write "<hr>" Response.Write "test:" & True %> Output: True -------------- test:Waar As you can see, as soon as you combine the output, its turned into a local string ('Waar' is dutch for true). I need it to stay "True". How can I change this? I dont mind putting some code at the beginning of the pages,

Custom locale configuration for float conversion

99封情书 提交于 2021-02-07 05:24:17
问题 I need to convert a string in the format "1.234.345,00" to the float value 1234345.00 . One way is to use repeated str.replace : x = "1.234.345,00" res = float(x.replace('.', '').replace(',', '.')) print(res, type(res)) 1234345.0 <class 'float'> However, this appears manual and non-generalised. This heavily upvoted answer suggests using the locale library. But my default locale doesn't have the same conventions as my input string. I then discovered a way to extract the characters used in

Time zone issue involving date fns format()

假装没事ソ 提交于 2021-02-06 20:18:29
问题 const dt = new Date('2017-12-12'); console.log(format(dt, 'YYYY-MM-DD')); The above code logs 2017-12-11 in the US, but 2017-12-12 in India. I followed this github thread here and tried out things but am not getting the desired results. My expectation is to print the same date irrespective of time zone Why I need this : Consider a scenario involving birthdates. If i am giving some input date, it has to be displayed as same date in all regions irrespective of their timezones. 回答1: You will

Time zone issue involving date fns format()

让人想犯罪 __ 提交于 2021-02-06 20:18:10
问题 const dt = new Date('2017-12-12'); console.log(format(dt, 'YYYY-MM-DD')); The above code logs 2017-12-11 in the US, but 2017-12-12 in India. I followed this github thread here and tried out things but am not getting the desired results. My expectation is to print the same date irrespective of time zone Why I need this : Consider a scenario involving birthdates. If i am giving some input date, it has to be displayed as same date in all regions irrespective of their timezones. 回答1: You will

Set 24-hour clock format in Jenkins

╄→尐↘猪︶ㄣ 提交于 2021-02-06 08:40:06
问题 Despite the fact that in http://<jenkins server>/systemInfo the user.timezone property value meets my actual time zone I still have 12-hour clock format. I would like to have 24-hour clock format instead. Does anyone have any ideas how it can be changed in Jenkins? Thank you. 回答1: As @Arkain mentioned, you should specify in browser's settings the language which suits your intended time format. I had both English (US) and just English (which I thought was English (GB)), but then I realized

java.lang.NumberFormatException while executing in France machine

南笙酒味 提交于 2021-02-05 06:58:06
问题 In below code while parsing the value sometimes i am facing NumberFormat Exception in France machine. double txPower; DecimalFormat df = new DecimalFormat("##.##"); txPower = txPower + getDeltaP(); log.info("txpower value is -- "+txPower); txPower = Double.parseDouble(df.format(txPower)); protected double getDeltaP() { return isNewChannelAddition ? apaConfig.deltaPadd : apaConfig.deltaPtune; } logs: txpower value is -- -7.9 java.lang.NumberFormatException: For input string: "-7,9" 回答1: I