Questions tagged [unicode-literals]

Use this tag for questions related to Unicode Literals. An example: ( u'some text' ), which is a different type of an object from a byte string ( 'some text' ).

is used in its general meaning, so make sure you provide a tag of your programming environment, if any, in your question.

For example in Python, quoting this answer:

A unicode literal ( u'some text' ) is a different type of Python object from a python byte string ( 'some text' ). It's like using \n versus \N ; the former has meaning in python literals (it's interpreted as a newline character), the latter just means a backslash and a capital N (two characters).

92 questions
0
votes
1 answer

'ی' and 'ک' are not searchable in main memory

I have a data set on main memory. It contains a set of Persian sentences. When I search in my memory I get good result, But when I put ی or ک in my keyword, I don't get a search result. my search func: UPDATE: def word_lookup(self,word,ayas): …
PersianGulf
  • 2,845
  • 6
  • 47
  • 67
0
votes
0 answers

Python dict mapping from hindi characters to unicode characters

Where can I get a Dictionary in python which contains mappings from Hindi characters to unicode characters? (Getting unicode characters corresponding to Hindi text character by character)
0
votes
1 answer

UnicodeEncodeError when formatting u'ES SIOUF_1' in Python 2

I have this code: "'{}'".format(u'ES SIOUF_1') When run in Python 2, I receive the following error: Traceback (most recent call last): File "", line 1, in UnicodeEncodeError: 'ascii' codec can't encode character…
umbe1987
  • 2,894
  • 6
  • 35
  • 63
0
votes
1 answer

Replace all unicode literals in string with corresponding symbol

I have a standard Python3 string containing multiple unicode literals (ex. "\u00c6" ) I need to turn them back into their corresponding characters (The scandinavian letters: æ, ø, å) I have tried googling it and using the .encode() and .decode()…
0
votes
1 answer

Python, Unicode: Working with badly formatted strings

I'm working on a Django app that gets data from a Redshift database. The people who wrote to this Redshift database made some bizarre choices. I'm trying to figure out how handle the fact that it has strings like this: Let’s play!…
0
votes
0 answers

How do I preg_replace literal unicode syntax?

I have a large data set that was converted from JSON data. It has unicode characters using the JSON-compliant \uXXXX notation. I'm trying to convert these to true unicode on the fly using preg_replace. preg_replace('/\\u([a-z0-9]+)/i', "\x{${1}}",…
Nilpo
  • 4,675
  • 1
  • 25
  • 39
0
votes
0 answers

U+2717 does not render correctly following an upgrade to Swift 3.1

I recently upgraded my app to Swift 3.1 (it was in Swift 2). Post upgrade I noticed that a unicode symbol I have been using for a long time is incorrectly displayed. The symbol is the 'ballot' symbol which in Swift is: "\u{2717}" The symbol…
zevij
  • 2,416
  • 1
  • 23
  • 32
0
votes
0 answers

UnicodeEncodeError 'ascii' codec can't encode character

I want to use a url(http://192.xxx.x.xxx:8080/가나다.png) that contains Korean characters to show an image. The server sent me an error starting with UnicodeEncodeError... I tried sys.setdefaultencoding and unicode_literals, but that didn't solve…
shin
  • 11
  • 3
0
votes
0 answers

deleting common words in python

How to delete common words from two documents thats extracted from two websites? I already extracted the news from two sites now I want to delete the common words from the two documents. I used the following code to extract news from two different…
Anila
  • 1
0
votes
1 answer

Marking text with unicode characters

I'm using markjs (https://markjs.io/) in my project. This is basically used to highlight text. It works fine except for some text with unicode characters in it. For example text with characters "\xA0" Here is the jsfiddle link for…
pravid
  • 719
  • 9
  • 27
0
votes
2 answers

How do I convert a string of "\u{0026}" to "&" in Swift?

I have a string that can contain unicode characters in the form of "\u{0026}" and I want it to be converted to its appropriate character "&". How do I do that? let input = "\\u{0026} something else here" let expectedOutput = "& something else…
Junz
  • 3
  • 2
0
votes
0 answers

c++ bell sound in eclipse using '\a'

I am using Windows, Eclipse CDT and Mingw-w64. I want to call an alert ( aka bell aka beep) by using '\a' character literal.When I run this: cout<<'\a'; computer doesn't produce any sound. I tried with endl, it didn't work. Sound on computer is…
0
votes
1 answer

Can I ensure that users that import my Python code use Unicode literals?

My code includes from __future__ import unicode_literals and has many functions that accept (and expect) Unicode strings as input in order to function fully. Is there a way to ensure that users (in scripts, Python, or IPython, etc.) also use…
orome
  • 45,163
  • 57
  • 202
  • 418
0
votes
1 answer

Why id() for same Unicode string literals gives different result?

Why Unicode string literals show different id's ? I was hoping the same behavior as that of String literals. >>> p = 'abcd' >>> q = 'abcd' >>> id(p) == id(q) True >>> p = u'abcd' >>> q = u'abcd' >>> id(p) == id(q) False Please provide some pointers…
Aashish P
  • 1,894
  • 5
  • 22
  • 36
-1
votes
1 answer

String with Unicode literal not displaying properly on UILabel

I've got some localized strings with Unicode literals in them, like so "some_key" = "\u{1F6C8} Some info text"; which I assign to UILabel myLabel.text = "some_key".localized Where localized getter looks like that extension String { var…
mag_zbc
  • 6,801
  • 14
  • 40
  • 62