locale

Windows Python: Changing encoding using the locale module

你说的曾经没有我的故事 提交于 2021-01-27 12:41:40
问题 Using Python 2.7 I am writing an abstract web scraper and am having problems when displaying (printing) certain characters. I get the trace-back error: UnicodeEncodeError: 'ascii' codec can't encode character u'\u2606' in position 5: ordinal not in range(128) from printing the string containing the character. I used the locale module to find out my OS supported settings, although I'm not certain I should use locale for my problem, and noticed the default settings where (en_US', 'cp1252') . I

Windows Python: Changing encoding using the locale module

陌路散爱 提交于 2021-01-27 12:40:50
问题 Using Python 2.7 I am writing an abstract web scraper and am having problems when displaying (printing) certain characters. I get the trace-back error: UnicodeEncodeError: 'ascii' codec can't encode character u'\u2606' in position 5: ordinal not in range(128) from printing the string containing the character. I used the locale module to find out my OS supported settings, although I'm not certain I should use locale for my problem, and noticed the default settings where (en_US', 'cp1252') . I

Changing an application's locale without changing the Windows locale

╄→尐↘猪︶ㄣ 提交于 2021-01-27 05:31:42
问题 I've got an interesting situation where locale settings has messed with my C# application, because I failed to realize that methods like Double.Parse will not convert "1000" to 1000, but do something unexpected due to the different numbering format. One solution to my problem would be to use something like double d = double.parse( "1000", new CultureInfo("en-US")); . Currently, I don't pass the CultureInfo. However, instead of having to make this change throughout the code, I was wondering if

Is there a way to force exception message to be English for Java 1.7

只谈情不闲聊 提交于 2021-01-26 19:29:55
问题 I've almost tried everything including: Change system region and language to be 'english US' Use Locale.setDefaultLocale() Pass in JVM arguments It prints out: Default locale is : en_US BUT my application is still throwing exception with Chinese exception message Does this have anything to do with Spring? (my app is based on Spring, but there is no locale-related config whatsover, so it should be just using whatever is default) Can anyone help me with this? UPDATE: I'm basically getting a

Is there a way to force exception message to be English for Java 1.7

孤街醉人 提交于 2021-01-26 19:29:04
问题 I've almost tried everything including: Change system region and language to be 'english US' Use Locale.setDefaultLocale() Pass in JVM arguments It prints out: Default locale is : en_US BUT my application is still throwing exception with Chinese exception message Does this have anything to do with Spring? (my app is based on Spring, but there is no locale-related config whatsover, so it should be just using whatever is default) Can anyone help me with this? UPDATE: I'm basically getting a

Is there a way to force exception message to be English for Java 1.7

不问归期 提交于 2021-01-26 19:27:15
问题 I've almost tried everything including: Change system region and language to be 'english US' Use Locale.setDefaultLocale() Pass in JVM arguments It prints out: Default locale is : en_US BUT my application is still throwing exception with Chinese exception message Does this have anything to do with Spring? (my app is based on Spring, but there is no locale-related config whatsover, so it should be just using whatever is default) Can anyone help me with this? UPDATE: I'm basically getting a

Postgres 12 case-insensitive compare

牧云@^-^@ 提交于 2021-01-26 08:49:06
问题 I'm attempting to move a SQL Server DB which is used by a C# application (+EF6) to Postgres 12 but I'm not having much luck with getting case-insensitive string comparisons working. The existing SQL Server db uses SQL_Latin1_General_CP1_CI_AS collation which means all WHERE clauses don't have to worry about case. I understand that CIText was the way to do this previously, but is now superseded by non-deterministic collations. I created such a collation; CREATE COLLATION ci (provider = icu,

How do I convert date to the string in go using locale?

你。 提交于 2021-01-22 13:23:39
问题 I convert date to a string this way: d.Format("Mon 02. Jan") and I get something like Fri 27. Jan How can I switch the locale and get the string in other language? 回答1: You can't. The Go standard library does not contain localized month, day and zone names. The names are wired into the time package. For example, the name of the months returned by Month.String() are stored in the unexported time.month global variable: var months = [...]string{ "January", "February", "March", "April", "May",

How do I convert date to the string in go using locale?

江枫思渺然 提交于 2021-01-22 13:22:33
问题 I convert date to a string this way: d.Format("Mon 02. Jan") and I get something like Fri 27. Jan How can I switch the locale and get the string in other language? 回答1: You can't. The Go standard library does not contain localized month, day and zone names. The names are wired into the time package. For example, the name of the months returned by Month.String() are stored in the unexported time.month global variable: var months = [...]string{ "January", "February", "March", "April", "May",

How do I convert date to the string in go using locale?

折月煮酒 提交于 2021-01-22 13:22:06
问题 I convert date to a string this way: d.Format("Mon 02. Jan") and I get something like Fri 27. Jan How can I switch the locale and get the string in other language? 回答1: You can't. The Go standard library does not contain localized month, day and zone names. The names are wired into the time package. For example, the name of the months returned by Month.String() are stored in the unexported time.month global variable: var months = [...]string{ "January", "February", "March", "April", "May",