character-encoding

Get pry to display characters like [äöüßÄÖÜß] (utf-8 encoding)? (Possibly Windows-specific issue?)

一曲冷凌霜 提交于 2019-12-30 06:59:19
问题 [ All the scripts I'm working with with these German characters are in UTF-8 themselves, have #encoding: utf-8 at the top (and Encoding.external_default = 'utf-8' , not that that's really relevant I think because German chars in strings that are defined within the script don't get displayed right.) ] All these things display fine at the windows command prompt and using irb etc. I can't even enter these characters at the pry prompt, though. Attempting to paste in puts "äöüÄÖÜß" gets puts " .

Get pry to display characters like [äöüßÄÖÜß] (utf-8 encoding)? (Possibly Windows-specific issue?)

三世轮回 提交于 2019-12-30 06:58:06
问题 [ All the scripts I'm working with with these German characters are in UTF-8 themselves, have #encoding: utf-8 at the top (and Encoding.external_default = 'utf-8' , not that that's really relevant I think because German chars in strings that are defined within the script don't get displayed right.) ] All these things display fine at the windows command prompt and using irb etc. I can't even enter these characters at the pry prompt, though. Attempting to paste in puts "äöüÄÖÜß" gets puts " .

UTF-8 MySQL and Charset

落爺英雄遲暮 提交于 2019-12-30 06:35:09
问题 Can someone explain me when I set everything to UTF-8 I keep getting those damn ��� MySQL Server version: 5.1.44 MySQL charset: UTF-8 Unicode (utf8) I create a new database name: utf8test collation: utf8_general_ci MySQL connection collation: utf8_general_ci My SQL looks like this: SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; CREATE TABLE IF NOT EXISTS `test_table` ( `test_id` int(11) NOT NULL, `test_text` text NOT NULL, PRIMARY KEY (`test_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; INSERT INTO `test

Using weekdays with any locale under Windows

心不动则不痛 提交于 2019-12-30 06:12:55
问题 I'm trying to get the day of the week, and have it work consistently in any locale. In locales with Latin alphabets, everything is fine. Sys.getlocale() ## [1] "LC_COLLATE=English_United Kingdom.1252;LC_CTYPE=English_United Kingdom.1252;LC_MONETARY=English_United Kingdom.1252;LC_NUMERIC=C;LC_TIME=English_United Kingdom.1252" weekdays(Sys.Date()) ## [1] "Tuesday" I have two related problems with other locales. If I set Sys.setlocale("LC_ALL", "Arabic_Qatar") ## [1] "LC_COLLATE=Arabic_Qatar

Cannot store Euro-sign into LOB String property with Hibernate/PostgreSQL

倖福魔咒の 提交于 2019-12-30 06:07:35
问题 I am having trouble writing and reading back special characters like the Euro-sign (€) into LOB String properties in PostgreSQL 8.4 with Hibernate 3.6.10. What I know is that PostgreSQL provides two distinct ways to store large character objects in a column of a table. They can be stored either directly into that table column or indirectly in a separate table (it's actually called pg_largeobject). In the latter case, the column holds a reference (OID) to the row in pg_largeobject. The default

To use utf8 or not - MySQL and PHP character encoding issue

随声附和 提交于 2019-12-30 05:20:13
问题 I have a string stored in MySQL like this: یکی از Ø where my table's character set is utf8 and collation is utf8_general_ci . When I retrieve the string from MySQL, the browser shows it like this: یکی از بهترین راه and it's ok (It is persian). Note: I used mysql_query("SET NAMES 'utf8_persian_ci'"); after connecting to MySQL. I put <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> tag in head of each page. Now, I need use mysql_query("SET NAMES 'utf8'"); . But after

DomDocument and html entities

本秂侑毒 提交于 2019-12-30 05:13:08
问题 I'm trying to parse some HTML that includes some HTML entities, like × $str = '<a href="http://example.com/"> A × B</a>'; $dom = new DomDocument; $dom -> substituteEntities = false; $dom ->loadHTML($str); $link = $dom ->getElementsByTagName('a') -> item(0); $fullname = $link -> nodeValue; $href = $link -> getAttribute('href'); echo " fullname: $fullname \n href: $href\n"; but DomDocument substitutes the text for for A × B. Is there some way to keep it from taking the & for an html entity and

Shift-JIS decoding fails using wifstrem in Visual C++ 2013

可紊 提交于 2019-12-30 05:05:07
问题 I am trying to read a text file encoded in Shift-JIS (cp 932) using std::wifstream, and std::getline. The following code works in VS2010 but fails in VS2013: std::wifstream in; in.open("data932.txt"); const std::locale locale(".932"); in.imbue(locale); std::wstring line1, line2; std::getline(in, line1); std::getline(in, line2); const bool good = in.good(); The file contains several lines, where the first line contains just ASCII characters, and the second is Japanese script. Thus, when this

context.Response.Charset = Encoding.UTF8.ToString();

橙三吉。 提交于 2019-12-30 04:48:09
问题 I had used this in my code to set the Charset but IE did not like it. Any reason why? context.Response.Charset = Encoding.UTF8.ToString(); I ended up having to set it to just context.Response.ContentType = "application/json;charset=utf-8" or context.Response.Charset = "utf-8"; instead. Not sure then what Encoding.UTF8.ToString(); would be utilized for if IE can't take it 回答1: Context.Response.Charset = Encoding.UTF8.WebName; Gets the name registered with the Internet Assigned Numbers

How do I use Python 3.2 email module to send unicode messages encoded in utf-8 with quoted-printable?

血红的双手。 提交于 2019-12-30 04:40:09
问题 I want to send email messages that have arbitrary unicode bodies in a Python 3.2 program. But, in reality, these messages will consist largely of 7bit ASCII text. So I would like the messages encoded in utf-8 using quoted-printable. So far, I've found this works, but it seems wrong: c = email.charset.Charset('utf-8') c.body_encoding = email.charset.QP m = email.message.Message() m.set_payload("My message with an '\u05d0' in it.".encode('utf-8').decode('iso8859-1'), c) This results in an email