I am interfacing with a Java application via Python. I need to be able to construct byte sequences which contain utf-8 strings. Java uses a modified utf-8 encoding in DataInputStream.readUTF() which ... |
I have a set of unicode numbers , I need to convert them to UTF-8 and print the result in to split them in to hex values.
eg: Unicode 0x80 should be ... |
I'm a Python beginner, and I have a utf-8 problem.
I have a utf-8 string and I would like to replace all german umlauts with ASCII replacements (in German, u-umlaut 'ü' may ... |
(The following is using Python 2.6.1)
I have 2 strings:
>>> a = u'\u05e8\u05db\u05e1'
>>> b = u'\u05e8\u05db\u05e1 \u05d4\u05d9\u05d0 \u05de\u05d0\u05d9\u05e8\u05d4 \u05d1\u05e4\u05e0\u05e1'
I encode them:
>>> ua = a.encode('utf-8')
>>> ub = b.encode('utf-8')
>>> ua
'\xd7\xa8\xd7\x9b\xd7\xa1'
>>> ub
'\xd7\xa8\xd7\x9b\xd7\xa1 \xd7\x94\xd7\x99\xd7\x90 \xd7\x9e\xd7\x90\xd7\x99\xd7\xa8\xd7\x94 \xd7\x91\xd7\xa4\xd7\xa0\xd7\xa1'
and ... |
this is my code:
from whoosh.analysis import RegexAnalyzer
rex = RegexAnalyzer(re.compile(ur"([\u4e00-\u9fa5])|(\w+(\.?\w+)*)"))
a=[(token.text) for token in rex(u"hi ? 000 ?????? there 3.141 big-time under_score")]
...
|
I'm getting back from a library what looks to be an incorrect unicode string:
>>> title
u'Sopet\xc3\xb3n'
Now, those two hex escapes there are the UTF-8 encoding for U+00F3 LATIN SMALL LETTER O WITH ... |
I saved my script in UTF-8 encoding.
I changed my codepage on windows to 65001.
I'm on python 2.6
Script #1
# -*- coding: utf-8 -*-
print u'Español'
x = raw_input()
Script #2
# -*- coding: utf-8 -*-
a = ...
|
|
I have a browser which sends utf-8 characters to my python server, but when I retrieve it from the query string, the encoding that python returns is ascii I think, how ... |
Python 2.6
Using Python string.replace() seems not working for UTF-16-LE file. I think of 2 ways:
- Find a Python module that can handle Unicode string manipulate.
- Convert the target Unicode file to ASCII, use ...
|
If I enter Baltic characters in textctrl and click button test1 I have an error
"InicodeEncodeError: 'ascii' codec can't encode characters in position 0-3:
...
|
I have a function accepting requests from the network. Most of the time, the string passed in is not unicode, but sometimes it is.
I have code to convert everything to unicode, ... |
I use Python 2.6.6
My locale is ('en_US', 'UTF8')
I try many ways to convert utf-8 string to big5, but it can't work.
If you know how to do that, please give me some ... |
I got three UTF-8 stings:
hello, world
hello, ??
hello, ?rld
I only want the first 10 ascii-char-width so that the bracket in one column:
[hello, wor]
[hello, ? ]
[hello, ?r]
In console:
width('??')==width('worl')
width('? ')==width('wor') #a white space ...
|
This line in my .py file is giving me a: "UnicodeDecodeError: 'utf8' codec can't decode bytes in position 8-13: unsupported Unicode code range"
if line.startswith(u"Fußnote"):
The file is saved in utf-8 and has ... |
Given in arbitrary "string" from a library I do not have control over, I want to make sure the "string" is a unicode type and encoded in utf-8. I would ... |
I am having trouble with .isupper() when I have a utf-8 encoded string. I have a lot of text files I am converting to xml. While the text is very variable ... |
I wrote a simple file parser and writer, but then I came across an article talking about the importance of unicode and then it occurred to me that I'm assuming the ... |
I am programming a script that will grab some data from my website using http GET.
My problem is that i have to pass unicode characters to the website.
I am reading a ... |
I already came up with this problem, but after some testing I decided to create a new question with some more specific Infos:
I am reading user accounts with python-ldap (and Python ... |
I am learning Bottle framework and new to Python. Just stumbled upon this difficulty. When I write a simple method to return a an Arabic string like:
@route('/hello')
def hello():
...
|
I'm using mutagen to convert ID3 tags data from cp1251/cp1252 to utf-8. In Linux there is no problem. But in Windows...
I have data from mutagen (library for work ... |
I need to insert a series of names (like 'Alam\xc3\xa9') into a list, and than I have to save them into a SQLite database.
I know that I can render these names ... |
I have a binary file. This file contains an UTF-8 string. Moreover, it is guaranteed that this string is just a single word.
In python, how can I get number of letters ... |
|
Python 2.6.4 (r264:75706, Nov 4 2009, 15:32:41) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-113)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> a = u'\u041C, \u0438 , \u0440' >>> print a Traceback (most recent call last): File "", line 1, in File "/usr/lib/python2.6/encodings/iso8859_15.py", line 12, in encode ... |
|