473,395 Members | 1,689 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

nonascii symbols

What's the trick for using nonascii symbols in string literals?
Jul 18 '05 #1
4 1305
In article <4dLHc.994550$Pk3.764369@pd7tw1no>, Elaine Jackson wrote:
What's the trick for using nonascii symbols in string literals?


Here's one way of doing it:

Python 2.4a1 (#1, Jul 9 2004, 21:24:13)
[GCC 2.95.3 20010315 (release)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
print "\xef" ï


Or, in other words, use backslash+x+hexadecimal number representing the byte
value of the symbol you wish to use. Be aware that exactly which symbol
appears when printed depends on the character encoding of your terminal.

For all the ways of doing this see:

http://www.python.org/dev/doc/devel/ref/strings.html

Best regards,

Troels Therkelsen

Jul 18 '05 #2

"Troels Therkelsen" <t_**********@hotmail.com> wrote in message
news:sl************************@abattoir.2-10.org...
In article <4dLHc.994550$Pk3.764369@pd7tw1no>, Elaine Jackson wrote:
What's the trick for using nonascii symbols in string literals?
Here's one way of doing it:

Python 2.4a1 (#1, Jul 9 2004, 21:24:13)
[GCC 2.95.3 20010315 (release)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
print "\xef" ï


Or, in other words, use backslash+x+hexadecimal number representing the

byte value of the symbol you wish to use. Be aware that exactly which symbol
appears when printed depends on the character encoding of your terminal.
Actually, it's supposed to depend on the character encoding comment
at the front of your program. (The default for 2.3 is supposed to be Latin1.
It was supposed to be Ascii for 2.4, but I haven't seen that in the 2.4a1
changes.)

Whether your editor understands this is a different issue.

John Roth


For all the ways of doing this see:

http://www.python.org/dev/doc/devel/ref/strings.html

Best regards,

Troels Therkelsen

Jul 18 '05 #3
On Sat, 10 Jul 2004 05:33:52 +0000, Elaine Jackson wrote:
What's the trick for using nonascii symbols in string literals?


Declare the file encoding in the 1st or second line do the file, like
this:

# -*- coding: utf-8 -*-
# Hello world, in portuguese.
print "Olá Mundo!"

However, this doesn't solve the problem of code portability over systems
with different chartsets.
To do that, I like using unicode string literals and locale.

# -*- coding: utf-8 -*-
import locale
country, coding = locale.getdefaultlocale()
str = u'Olá Mundo!'
print str.encode(coding)

--
Ricardo

Jul 18 '05 #4
I guess the solution is using unicode strings:
http://docs.python.org/tut/node5.htm...00000000000000
"Elaine Jackson" <el***************@home.com> wrote in message
news:4dLHc.994550$Pk3.764369@pd7tw1no...
What's the trick for using nonascii symbols in string literals?

Jul 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Torbak | last post by:
I got some question about symbols in libraries ... In libraries, there is public symbols and "not public" symbols (private, static)... In C when we use the "static" keyword on the declaration of...
1
by: Torbak | last post by:
I got some question about symbols in libraries ... In libraries, there is public symbols and "not public" symbols (private, static)... In C when we use the "static" keyword on the declaration of...
1
by: aerobar2 | last post by:
When I debug my application I get "no symbols loaded" ================= 'DefaultDomain': Loaded 'c:\winnt\microsoft.net\framework\v1.1.4322\mscorlib.dll', No symbols loaded. 'MHSFire': Loaded...
1
by: asdf | last post by:
Hello, I was enjoying working in VS for half a year without any problems and now I cannot debug anymore. Without any really reason my Studio tells me that the page that I want to debug has - No...
5
by: eScrewDotCom | last post by:
www.eScrew.com eScrew Welcome to eScrew! eScrew is eScrew and this is eScrew story. eScrew will tell you eScrew story if you promise eScrew to consider eScrew story as joke. eScrew story is...
10
by: RDI | last post by:
What's it mean? My prog runs fine. Then as soon as I press ok or cancel, the following is what's in the output area of the debugger. TIA -- RDI (remove the exclamation from the email...
47
by: Pierre Barbier de Reuille | last post by:
Please, note that I am entirely open for every points on this proposal (which I do not dare yet to call PEP). Abstract ======== This proposal suggests to add symbols into Python. Symbols...
3
by: JV | last post by:
Hi All, I am new to C# and I am having trouble compiling and running code. I have the code written (it was just an example that I took) and I run it, it gives me No Symbols loaded error as...
0
by: shan | last post by:
*** ERROR: Module load completed but symbols could not be loaded for crystaldecisions.web.dll *** ERROR: Module load completed but symbols could not be loaded for crystalenterpriselib.dll ***...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.