I used an anonymous pipe to capture all stdout,and stderr then print into a richedit, it's ok when i use wsprintf ,but the python using multibyte char that really annoy me. how can I convert all these output to unicode?
UPDATE 2010-01-03:
thanx for the reply. but, it seems the str.encode() only worked with print xxx stuff, if there is ...
In MySQL, if I create a new VARCHAR(32) field in a UTF-8 table does it means I can store 32 bytes of data in that field or 32 chars (multi-byte)?
...
The user entered the word
éclair
into the search box.
Showing results 1 - 10 of about 140 for �air.
Why does it show the weird question mark?
I'm using Django to display it:
Showing results 1 - 10 of about 140 for {{query|safe}}
...
When I do:
return render_to_response()
in Django. How do I set the content-type to UTF-8? So that everything displayed is UTF-8?
...
I've got the following error:
TemplateSyntaxError at
/admin/results_cop/copsegmentresult/
Caught an exception while rendering:
('ascii', 'ISU European Figure Skating
Championships 2009: Senior Ladies
Ladies: Short Program - 2. Susanna
P\xc3\x96YKI\xc3\x96', 98, 99,
'ordinal not in range(128)')
The fragment of the s...
It throws out "UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 2: ordinal not in range(128)" when executing following code:
filename = 'Spywaj.ttf'
print repr(filename)
>> 'Sp\xc2\x88ywaj.ttf'
filepath = os.path.join('/dirname', filename)
But the file is valid and existed on disk. Filename was extracted from "unzi...
Let's say I have this:
char registered = '®';
or an umlaut, or whatever unicode character. How could I get its code?
...
I'm working on a little script to help me learn the Japanese Kana (Hiragana/Katakana). In total, there are probably 100+ (+||-).
Basically, all it would do is take in the english version and convert it to the character.
ie. a = 'あ' which is 12354 in decimal
What I have so far is this:
hiraDict = { "a" : 12354, "i" : 12356 ...}
if ...
Hello,
In my django app, I have some objects that cause the corresponding URL in the django admin to be non ascii. (for example: http://mysite/admin/myapp/myclass/Présentation/)
I can edit the object without any problem but when I save it I have the following error:
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in p...
Here is my code, I'm sure it looks terrible but it all works as it should, only problem I'm having is with the last line...
import pyPdf
import os
import csv
class UnicodeWriter:
"""
A CSV writer which will write rows to CSV file "f",
which is encoded in the given encoding.
"""
def __init__(self, f, dialect=csv.exc...
Windows uses an invalid codepage for keyboard layout in my language, I'm wonderf if there is a way to connect with Microsoft Windows Localization Center and give them the right keyboard layout to put in windows,
I try this in Windows blog (by commenting) and e-mailing with some good guy that I knew but no feedback received.
I'm still w...
Really spent a lot of time searching for this. Please need some help.
I am trying to add multilingual feature to my web app framework. For this I am unable to send non ascii characters as JSON. Here is what I am doing
Here is what I get from the database
'\xe0\xa4\xa4\xe0\xa5\x87\xe0\xa4\xb8\xe0\xa5\x8d\xe0\xa4\xa4'
which when I pri...
I don't know how else to explain, so I'll give you List of greek words with english derivatives. Look at the a table, please, first column. Notice there are words like ἄβαξ. Using Ruby 1.9.1, which has better encoding support than Ruby 1.8, how could I iterate over each character forming that word? For example, I'd like to get the letter...
Hi,
I am trying to filter user input depending on their charset. I am displaying keywords from user inputs to other users but to not want to display e.g. arabic or chinese characters but only english/latin characters.
How can I do that with PHP? Is there a easy solution on doing this?
Thanks.
...
print u'\xe4\xf6\xfc'.encode('utf-8')
print unicode(u'\xe4\xf6\xfc')
traceback:
盲枚眉
Traceback (most recent call last):
File "D:\zjm_code\a.py", line 6, in <module>
print unicode(u'\xe4\xf6\xfc')
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-2: ordinal not in range(128)
python shell
>>>u"äöü".encode...
The below example should work with Unicode strings but it doesn't.
CFStringRef aString = CFSTR("one"); // in real life this is an Unicode string
CFStringRef formatString = CFSTR("This is %s example"); // also tried %S but without success
CFStringRef resultString = CFStringCreateWithFormat(NULL, NULL, formatString, aString);
// Here I...
I need to convert unicode string to ascii to make a nice string for friendly url. Dont's ask me why dont do this in server side, please.
...
I have two questions
Can this code be added to blogger?
Can this code embed unicode fonts? and if can, please tell me the link how to do it.
...
How do I treat the elements of @ARGV as UTF-8 in Perl?
Currently I'm using the following work-around ..
use Encode qw(decode encode);
my $foo = $ARGV[0];
$foo = decode("utf-8", $foo);
.. which works but is not very elegant.
I'm using Perl v5.8.8 which is being called from bash v3.2.25 with a LANG set to en_US.UTF-8.
...
I know that there are already several questions on StackOverflow about std::string versus std::wstring or similar but none of them proposed a full solution.
In order to obtain a good answer I should define the requirements:
multiplatform usage, must work on Windows, OS X and Linux
minimal effort for conversion to/from platform specif...