How do i use japanese filenames in RenPy?

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
Vendor_Honyaku
Regular
Posts: 30
Joined: Thu Apr 09, 2009 8:31 am
Projects: Honyaku-Subs translations
Location: Russia, Novosibirsk
Contact:

How do i use japanese filenames in RenPy?

#1 Post by Vendor_Honyaku »

How do i use japanese filenames in RenPy?

I wrote this script:

Code: Select all

init:
    image splash logo1 = "cg/sys/title/注意事項.jpg"
    
# game start

label start:
    scene splash logo1

    centered "123"
And got traceback:

Code: Select all

I'm sorry, but an exception occured while executing your Ren'Py
script.

UnicodeEncodeError: 

While running game code:
 - script at line 11 of D:\renpy-6.9.3-rus\project7/game/script.rpy

-- Full Traceback ------------------------------------------------------------

  File "D:\renpy-6.9.3-rus\renpy\bootstrap.py", line 260, in bootstrap
  File "D:\renpy-6.9.3-rus\renpy\main.py", line 308, in main
  File "D:\renpy-6.9.3-rus\renpy\main.py", line 92, in run
  File "D:\renpy-6.9.3-rus\renpy\execution.py", line 230, in run
  File "D:\renpy-6.9.3-rus\renpy\ast.py", line 341, in execute
  File "D:\renpy-6.9.3-rus\renpy\exports.py", line 507, in say
  File "D:\renpy-6.9.3-rus\renpy\character.py", line 546, in __call__
  File "D:\renpy-6.9.3-rus\renpy\character.py", line 505, in do_display
  File "D:\renpy-6.9.3-rus\renpy\character.py", line 320, in display_say
  File "D:\renpy-6.9.3-rus\renpy\ui.py", line 69, in interact
  File "D:\renpy-6.9.3-rus\renpy\display\core.py", line 1364, in interact
  File "D:\renpy-6.9.3-rus\renpy\display\core.py", line 1509, in interact_core
  File "D:\renpy-6.9.3-rus\renpy\display\core.py", line 241, in predict
  File "D:\renpy-6.9.3-rus\renpy\display\core.py", line 215, in visit_all
  File "D:\renpy-6.9.3-rus\renpy\display\core.py", line 241, in <lambda>
  File "D:\renpy-6.9.3-rus\renpy\display\im.py", line 429, in predict_one
  File "D:\renpy-6.9.3-rus\renpy\display\im.py", line 188, in get
  File "D:\renpy-6.9.3-rus\renpy\display\im.py", line 458, in load
UnicodeEncodeError: 

While running game code:
 - script at line 11 of D:\renpy-6.9.3-rus\project7/game/script.rpy

Ren'Py Version: Ren'Py 6.9.3c
The bear looked on the car, and there was a wild gleam in his eyes. He knew what to do.

User avatar
killdream
Veteran
Posts: 325
Joined: Wed Nov 05, 2008 1:05 pm
Projects: EVūL (WIP), insilo (WIP), Cute Demon Crashers!
Deviantart: robotlolita
Github: robotlolita
Location: World's End (aka Brazil)
Contact:

Re: How do i use japanese filenames in RenPy?

#2 Post by killdream »

I'm not sure you can use non-ascii characters in filenames in Ren'Py. But anyways, some systems won't support them, so you better off using only ascii charset.

User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: How do i use japanese filenames in RenPy?

#3 Post by PyTom »

You should be able to use a Japanese filename by writing:

Code: Select all

    image splash logo1 = u"cg/sys/title/注意事項.jpg"
The important bit is the u, which tells Ren'Py this is a unicode string.

That being said, you may run into problems when distributing your game. The problem here is that common file formats (like zip and tar) do not define a filename encoding. So if you unzip your game on a Japanese system, it will work. But if you try to run it on a Basque system, it might not.

This is made more difficult by different platforms using different encoding systems. So a game that uses non-ASCII filenames that's packaged on a Windows system (which might use Shift-JIS for filenames) could have problems when unpacked on a Macintosh, which expects UTF-8.

(There's also the problem that adding to Ren'Py the logic to deal with these files would add more than a megabyte to the minimum game size, due to the massive tables required to deal with the Chinese, Japanese, and Korean languages, and the somewhat smaller tables used to deal with everything else.)
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

Koveras
Regular
Posts: 165
Joined: Sat Dec 13, 2008 1:15 pm
Projects: The King's Dragon (TBA)
Location: Karlsruhe, Germany
Contact:

Re: How do i use japanese filenames in RenPy?

#4 Post by Koveras »

Yeah, basically, if you want to make the players' lives (and your own, too) easier, use ASCII in all file system object names. ^^
"Yo, Buddy, you still alive?"

Post Reply

Who is online

Users browsing this forum: No registered users