Hello, All:

My first post... I've looked high and low for the ability to write a Chinese language text string in a program.

For example:

myString = "你好"

So that if you say:

print myString

on the console you will see:

你好


But I have yet to be successful. First off, can Python do this, and second, what is the *easiest* way to make it happen? I'm certain I'm not the only one who would like to use Unicode in their source programs, or be able to process Unicode strings, but every article I've seen does it differently. Is there another language that will do this easily?

Surely, this is not difficult, is it?

Hello, All:

My first post... I've looked high and low for the ability to write a Chinese language text string in a program.

For example:

myString = "你好"

So that if you say:

print myString

on the console you will see:

你好


But I have yet to be successful. First off, can Python do this, and second, what is the *easiest* way to make it happen? I'm certain I'm not the only one who would like to use Unicode in their source programs, or be able to process Unicode strings, but every article I've seen does it differently. Is there another language that will do this easily?

Surely, this is not difficult, is it?

Addendum:

While this was very difficult in Python 2.5, it is trivial in Python 3.0. :)
Using the print() function in Python 3.0 seems to print any combination of Chinese text that I throw at it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.