Special Characters in Dialogue

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
Dragonstar89
Regular
Posts: 163
Joined: Mon Aug 12, 2013 11:28 pm
Projects: TBA
Organization: Self
IRC Nick: dstar89
Deviantart: senpai-jake
Skype: dstar_891
Location: West Virginia, USA
Contact:

Special Characters in Dialogue

#1 Post by Dragonstar89 »

I've been searching a lot and a lot on this, and re-read the documents but I'm not too sure what to do at this moment. Basically, as the title says, I want to know specifically how Ren'Py goes about to include 'special characters' in dialogue?

Things like the yen (¥) symbol, Euro (€), etc. Being a web developer at core, I know this sorta thing will usually depend on the charset such as UTF-8, Unicode, etc. But I'm clueless as to what Ren'Py uses, and what's the standard for writing out the special character in a string of dialogue.

Thanks in advance.
Beginning pre-production work on a project in Renpy. After being away for 5 years, it's time to get back in the game 8)

Asceai
Eileen-Class Veteran
Posts: 1258
Joined: Fri Sep 21, 2007 7:13 am
Projects: a battle engine
Contact:

Re: Special Characters in Dialogue

#2 Post by Asceai »

Simply create scripts in UTF-8 and make sure you have a font that supports your special characters.

User avatar
i1abnrk
Regular
Posts: 38
Joined: Wed Nov 20, 2013 1:50 pm
Projects: Critter Corral, Haremu Kikkemu Mo
IRC Nick: i1abnrk
Deviantart: i1abnrk
Github: i1abnrk
Location: Wisconsin
Contact:

Re: Special Characters in Dialogue

#3 Post by i1abnrk »

Python and renpy both use UTF-8 as default. But that doesn't mean the text editor you use does. Look in the options of your text editor to see if you find and set the 'default encoding' to UTF-8. If not you can either use a different editor, you can use 'alt codes' where you hold alt and type the utf character number on the number pad, or you can use the 'character map' a utility program in Windows to copy and paste them to the editor.

Asceai
Eileen-Class Veteran
Posts: 1258
Joined: Fri Sep 21, 2007 7:13 am
Projects: a battle engine
Contact:

Re: Special Characters in Dialogue

#4 Post by Asceai »

i1abnrk wrote:Python and renpy both use UTF-8 as default. But that doesn't mean the text editor you use does. Look in the options of your text editor to see if you find and set the 'default encoding' to UTF-8. If not you can either use a different editor, you can use 'alt codes' where you hold alt and type the utf character number on the number pad, or you can use the 'character map' a utility program in Windows to copy and paste them to the editor.
I don't think either of those will help if the editor doesn't support UTF-8, because it won't be creating UTF-8 files and probably won't even display those special characters. And if it does display them, they're probably in the system encoding (likely Latin-1) so characters other than the things you can type on a keyboard anyway won't be valid UTF-8 and will not look as you expect in ren'py.

There is one thing you can do, though, without a UTF-8 editor. Python (and therefore hopefully by extension Ren'Py, but I haven't tested this and don't know) lets you specify unicode codepoints through escape sequences using \u#### (for 16-bit codepoints) and \U######## (for 32-bit codepoints). The #### is a hex value in each case. To use this, first find the codepoint (in hex) of the unicode character you would like. Fileformat.info's unicode pages are good for this.
For example, Unicode Character 'SNOWMAN'. The hex value is in the URL, but it's also in the title, under 'UTF-16 (hex)' and everywhere else on that page- 2603. To use this, just put in \u2603. For example

Code: Select all

label start:
   eileen "A snowman for you! \u2603"
Voila, a snowman without needing a UTF-8-supporting editor.

Anyway, easiest way is to just get an editor that does support UTF-8. I'm a big Notepad2 fan myself.

User avatar
Dragonstar89
Regular
Posts: 163
Joined: Mon Aug 12, 2013 11:28 pm
Projects: TBA
Organization: Self
IRC Nick: dstar89
Deviantart: senpai-jake
Skype: dstar_891
Location: West Virginia, USA
Contact:

Re: Special Characters in Dialogue

#5 Post by Dragonstar89 »

Asceai wrote:
i1abnrk wrote:Python and renpy both use UTF-8 as default. But that doesn't mean the text editor you use does. Look in the options of your text editor to see if you find and set the 'default encoding' to UTF-8. If not you can either use a different editor, you can use 'alt codes' where you hold alt and type the utf character number on the number pad, or you can use the 'character map' a utility program in Windows to copy and paste them to the editor.
I don't think either of those will help if the editor doesn't support UTF-8, because it won't be creating UTF-8 files and probably won't even display those special characters. And if it does display them, they're probably in the system encoding (likely Latin-1) so characters other than the things you can type on a keyboard anyway won't be valid UTF-8 and will not look as you expect in ren'py.

There is one thing you can do, though, without a UTF-8 editor. Python (and therefore hopefully by extension Ren'Py, but I haven't tested this and don't know) lets you specify unicode codepoints through escape sequences using \u#### (for 16-bit codepoints) and \U######## (for 32-bit codepoints). The #### is a hex value in each case. To use this, first find the codepoint (in hex) of the unicode character you would like. Fileformat.info's unicode pages are good for this.
For example, Unicode Character 'SNOWMAN'. The hex value is in the URL, but it's also in the title, under 'UTF-16 (hex)' and everywhere else on that page- 2603. To use this, just put in \u2603. For example

Code: Select all

label start:
   eileen "A snowman for you! \u2603"
Voila, a snowman without needing a UTF-8-supporting editor.

Anyway, easiest way is to just get an editor that does support UTF-8. I'm a big Notepad2 fan myself.
Thanks the:

Code: Select all

label start:
   eileen "A snowman for you! \u2603"
Is all I needed to know how to do :D I got it working now. Anyways, my editor is Notepad++ with UTF-8 without BOM encoding.
Beginning pre-production work on a project in Renpy. After being away for 5 years, it's time to get back in the game 8)

Post Reply

Who is online

Users browsing this forum: Google [Bot], Semrush [Bot]