encoding

Email subject MIME encoding in Perl.

梦想与她 提交于 2019-12-31 04:05:07
问题 I am trying to send an email with non-ASCII characters in the subject line under Perl 5.8.5. My simple example uses the word "Änderungen" (German umlaut), but instead of correctly converting the "Ä" the subject line will always turn out as "Ã?nderungen". #!/usr/bin/env perl use warnings; use strict; use Encode qw(decode encode); my $subject = "Änderungen"; my $subject_encoded = encode("MIME-Q", $subject); [...] open(MAIL, "| /usr/sbin/sendmail -n -t $recipient") || return "ERROR"; print MAIL

Using “En Dash” in an input file to a batch file

落花浮王杯 提交于 2019-12-31 03:22:06
问题 Most tragically, I got several TFS team projects with an en dash in them. If you are not familiar with en dash, open up MS Word and type in alt+8211. You will see a larger looking dash. (Like this if it renders for you: –). If you open notepad you will see a ? and if you try it in most Unicode editors you will see ‼. But I need it to be a dash. Because I need to run a batch file against all my projects. The paths to the projects now has this en dash in it. I make a file that holds the names

Emoji in R [UTF-8 encoding]

梦想的初衷 提交于 2019-12-31 02:42:08
问题 I'm trying to make an emoji analysis on R. I have stored some tweets where there are emojis. Here is one of the tweet that I want to analyze : > tweetn2 [1] "Programme du week-end: \xed\xa0\xbd\xed\xb2\x83\xed\xa0\xbc \xed\xbe\xb6\xed\xa0\xbc \xed\xbd\xbb\xed\xa0\xbc\xed\xbd\xbb\xed\xa0\xbc \xed\xbd\xbb\xed\xa0\xbc\xed\xbd\xbb" To be sure that I have "UTF-8": > Encoding(tweetn2) [1] "UTF-8 " Now when I'm trying to recognize some characters, it's not working fine > grepl("\\xed",tweetn2) [1]

why does xmltextreader convert html encoded utf8 characters to utf8 string automatically?

我的未来我决定 提交于 2019-12-31 02:17:28
问题 I receive an XML file with encoding "ISO-8859-1" (Latin-1) Within the file (among other tags) I have <OtherText>Example "content" And ─</OtherText> Now for some reason when I load this into XMLTextReader and do a "XmlReader.Value" to return the value, it returns: "content" And ─ This then, when confronted with a database only accepting Latin-1 encoding, obviously errors. I have tried the following: Converting into bytes and using Encoding.Convert to change from UTF-8 into Latin-1 (which

Defining unicode variables in Python

微笑、不失礼 提交于 2019-12-31 02:15:07
问题 Recently, I have been reading about the Python source code encoding, especially PEP 263 and PEP 3120. I have the following code: # coding:utf-8 s = 'abc∂´ƒ©' ƒ = 'My name is' ß = '˚ß˙ˆ†ˆ∆ ßå®åø©ˆ' print('s =', s) print('ƒ =', ƒ, 'ß =', ß) This code works fine for Python3 but results in a SyntaxError in Python2.7 . I do understand that this probably might have nothing to do with source code encoding. So, I would like to know if there is a way to support Unicode variable names in Python2. In

Could File::Find::Rule be patched to automatically handle filename character encoding/decoding?

南笙酒味 提交于 2019-12-31 01:48:20
问题 Suppose I have a file with name æ (UNICODE : 0xE6, UTF8 : 0xC3 0xA6) in the current directory. Then, I would like to use File::Find::Rule to locate it: use feature qw(say); use open qw( :std :utf8 ); use strict; use utf8; use warnings; use File::Find::Rule; my $fn = 'æ'; my @files = File::Find::Rule->new->name($fn)->in('.'); say $_ for @files; The output is empty, so apparently this did not work. If I try to encode the filename first: use Encode; my $fn = 'æ'; my $fn_utf8 = Encode::encode(

how to make sql developer display non-English character correctly instread of displaying squares?

柔情痞子 提交于 2019-12-31 00:59:13
问题 in sql developer--preference Environment--encoding is already set to 'UTF-8' Code Editor--fonts was set to 'Verdana' Database--NLS--Language was set to 'American' The data in db was written by Java in UTF-8 encoding (95% percent sure) What else I need to do to make it displayed correctly? Note: the squares characters are actually Chinese characters. 回答1: Problem solved. Using font 'Microsoft YaHei' 回答2: sqldeveloper uses the system fonts from the host machine. On my Win8 system there is a

Disable encoding of unicode characters in ASP.NET-MVC3

回眸只為那壹抹淺笑 提交于 2019-12-31 00:45:30
问题 On my site every text is served as UTF-8. Since nowadays every browser supports unicode characters, I would like to use them as-is. The asp.net framework is very helpful by replacing any unicode with a Numeric Character Reference, like á . For reference check: http://en.wikipedia.org/wiki/Unicode_and_HTML#HTML_document_characters Sure, this way the webpage renders correctly in the oldest netscape possible, but for example the google analytics ecommerce module has some trouble understanding

Can't make (UTF-8) traditional Chinese character to work in PHP gettext extension (.po and .mo files created in poEdit)

为君一笑 提交于 2019-12-30 19:55:14
问题 I checked MSDN and the locale string is zh_Hant, but I also tried with zh_TW (Chinese, Taiwan). The traditional Chinese characters look OK in the poEditor, but when I open the file in the browser the characters are just weird symbols («¢Åo¥@¬É!). I think the translation is working, but there's something wrong with the encoding (I used UTF-8 for both Charset and Source Code Charset). The files generated with poEditor: messages.po: msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs

How can I properly align UTF-8 strings with Perl's printf?

倾然丶 夕夏残阳落幕 提交于 2019-12-30 18:55:32
问题 what is the right way to get here a beautiful output ( all lines the same indent )? #!/usr/bin/env perl use warnings; use strict; use DBI; my $phone_book = [ [ qw( name number ) ], [ 'Kroner', 123456789 ], [ 'Holler', 123456789 ], [ 'Mühßig', 123456789 ], [ 'Singer', 123456789 ], [ 'Maurer', 123456789 ], ]; my $dbh = DBI->connect( "DBI:CSV:", { RaiseError => 1 } ); $dbh->do( qq{ CREATE TEMP TABLE phone_book AS IMPORT( ? ) }, {}, $phone_book ); my $sth = $dbh->prepare( qq{ SELECT name, number