Plz help me,how to show Chinese Fonts?

My code is:

class World:
def init(self):
#This is the initialization we had before
self.title = OnscreenText( #Create the title
text= u’\u6C49\u5B57’,
style=1, fg=(1,1,1,1), pos=(0.8,-0.95), scale = .07)
w = World()
run()

The wrong is: ascii codec cannot encode characters :astonished:rdinal not in range<128>

plz help.

All that error message sounds like Panda3D is ASCII-only, though I might be wrong…

I never even tried German special characters (like Umlauts), probably out of curiosity I should… 128 isn’t terribly much if this were in fact the limit (4bit).

Any plans on adding Unicode support (provided that it’s not there yet)? :slight_smile:

Maybe this can help you

class World:
	def __init__(self):
		#This is the initialization we had before
		self.title = OnscreenText( #Create the title
		text= ('test \'%c\'' % ( 191 ) ),
		style=1, fg=(1,1,1,1), pos=(0.8,-0.95), scale = .07)

w = World()
run() 

@Marc: Umlaute sind möglich. German special characters are supported
http://www.python.org/peps/pep-0263.html

Martin

Ok, thanks - one less thing to try out. :slight_smile:

But what about Chinese characters, Kanji etc.? Does Panda “swallow” (and render) them as well?

Ok, thanks - one less thing to try out. :slight_smile:

But what about Chinese characters, Kanji etc.? Does Panda “swallow” (and render) them as well?

BTW, Martin, check out http://panda3d.de. Josh-approved, but not really done yet. :slight_smile:

I’m looking forward to fully-supporting version.

See this thread for displaying Chinese (or any other Unicode) characters in Panda:
https://discourse.panda3d.org/viewtopic.php?t=555

David

Good to see that Panda3D does already support Unicode! :slight_smile: It makes sense, tho, otherwise a game to teach Japanese in Panda would probably not be too easy to do… :stuck_out_tongue: