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
1
vote
1 answer

Python encoding errors from comments containing Windows paths

I want to include Windows paths in python script comments, without causing an encoding error. If I include a Windows path in a comment, I will sometimes get an encoding error, e.g., "UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa6 in…
1
vote
1 answer

Unicode character do not return the correct results

This command works as expected and return 1 node. # cat myfile.txt Amar joshi # xpath -e "/feed/entry[author/name='Amar joshi']" myfile.txt Found 1 nodes in myfile.txt: But this does…
shantanuo
  • 31,689
  • 78
  • 245
  • 403
1
vote
2 answers

Powershell force convert the ConvertFrom-Json output to string which can then be used in all string operations incl. filenaming

As I have mentioned in the Question title, I want to convert the ConvertFrom-Json command's output to string such that, the character/string I get, should be usable such that it can be inserted into DateTime string as replacement to another…
Vicky Dev
  • 1,893
  • 2
  • 27
  • 62
1
vote
1 answer

Python3 - Convert unicode literals string to unicode string

From command line parameters (sys.argv) I receive string of unicode literals like this: '\u041f\u0440\u0438\u0432\u0435\u0442\u0021' For example this script uni.py: import sys print(sys.argv[1]) command line: python uni.py…
1
vote
0 answers

How to Combine Unicode characters in .kcm file for Physical Keyboard on Android?

There are some characters which are not included in Unicode(i.e. श्र which is combination of \u0936 \u094D \u0930) but can be created using combining sequences. I am unable to figure out how to add this for a Physical Keyboard on Android using…
1
vote
0 answers

Configure SQL Server to use unicode literals by default

We are migrating a classic ASP application, using SQL Server, to multilanguage, and for this, as first step we have to migrate from ansi / windows-1252 charset to Unicode. We have succeed moving the ASP programs (saving then in UTF-8 with BOM do the…
Sourcerer
  • 1,891
  • 1
  • 19
  • 32
1
vote
2 answers

Python 2.7: Names of unicode representations

What are the names for these different kinds of ascii representations of unicode? \xF0\x9F\x98\xA2 \U0001f622 And is there a term for the set that they belong to that's more specific than "representation"? And in the context of these, how would I…
Nathan Hinchey
  • 1,191
  • 9
  • 30
1
vote
1 answer

unicode string literals in C++/CLI

Lets say I have this fragment of code which returns a unicode CLR string with Cyrillic letters property String^ EIDErrorDescriptionSr { String^ get() { switch(EIDErrorCode) { case EID_OK: return…
mmix
  • 6,057
  • 3
  • 39
  • 65
1
vote
1 answer

How does the u and r prefixes work with strings in python?

I know that we can use the r(raw string) and u(unicode) flags before a string to get what we might actually desired. However, I am wondering how these do work with strings. I tried this in the IDLE: a = r"This is raw string and \n will come as…
thiruvenkadam
  • 4,170
  • 4
  • 27
  • 26
1
vote
2 answers

Cannot render js unicode character `\u1F310`

For example omega symbol rendered properly '\u03A9', but globe symbol '\u1F310' http://www.fileformat.info/info/unicode/char/1f310/index.htm - not. Was tried on console and node environments
1
vote
1 answer

Assign Unicode Literals to PowerShell Hash Table

It's late and I am done for tonight--can someone please lend a hand on getting this to work? Do I need to do some additional work to get these Unicode strings assigned as literals? First attempt at creating a hash table of double-encoded and desired…
iokevins
  • 1,427
  • 2
  • 19
  • 29
1
vote
1 answer

Printing unicode literals in C

I am making an OpenVG application for Raspberry Pi that displays some text and I need a support for foreign characters (Polish in this case). I plan to prepare a function that maps unicode characters to literals in C in some higher level language…
Paweł Duda
  • 1,713
  • 4
  • 18
  • 36
1
vote
1 answer

Unicode literals in Visual C++

Consider the following code: #include #include #include int main() { std::string s = "\xe2\x82\xac\u20ac"; std::ofstream out("test.txt"); out << s.length() << ":" << s << std::endl; out << std::endl; …
Tom
  • 7,269
  • 1
  • 42
  • 69
1
vote
2 answers

How to create an unicode instance from an unicode literal

Due to some bug in a C extension, I'm getting unicode data with str instances, or in order words, str with no encoding at all and an unicode literal. So, for instance, this is a valid unicode literal >>> u'\xa1Se educado!' And the UTF-8 encoded str…
Pedro Werneck
  • 40,902
  • 7
  • 64
  • 85
1
vote
1 answer

Specifying unicode literal's encoding on a per-literal basis

According to the documentation, it is possible to define the encoding of the literals used in the python source like this: # -*- coding: latin-1 -*- u = u'abcdé' # This is a unicode string encoded in latin-1 Is there any syntax support to specify…
blueFast
  • 41,341
  • 63
  • 198
  • 344