# Can't Chinese characters be set for packaging names?

**URL:** https://forum.castle-engine.io/t/cant-chinese-characters-be-set-for-packaging-names/1234
**Category:** Uncategorized
**Created:** [June 17, 2024, 8:24am UTC](https://forum.castle-engine.io/t/cant-chinese-characters-be-set-for-packaging-names/1234 "2024-06-17T08:24:24Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![a493203176](https://forum.castle-engine.io/letter_avatar_proxy/v4/letter/a/cc9497/32.png) [@a493203176](https://forum.castle-engine.io/u/a493203176)
#### Post date: [June 17, 2024, 8:24am UTC](https://forum.castle-engine.io/t/cant-chinese-characters-be-set-for-packaging-names/1234/1 "2024-06-17T08:24:24Z")

</div>

Can’t Chinese characters be set for packaging names? I have tested both Windows and Android platforms and encountered errors during compilation

 ![image](https://forum.castle-engine.io/uploads/default/original/2X/b/b54a12f32c89d40bfae70032bacefab485685d0a.png)

---

<div class="post-metadata">

### Author: ![michalis](https://forum.castle-engine.io/user_avatar/forum.castle-engine.io/michalis/32/3_2.png) [@michalis](https://forum.castle-engine.io/u/michalis)
#### Post date: [June 17, 2024, 8:48am UTC](https://forum.castle-engine.io/t/cant-chinese-characters-be-set-for-packaging-names/1234/2 "2024-06-17T08:48:14Z")

</div>

It’s not about Chinese, to be clear.

The project name can only contain ASCII letters (a-z), digits, underscore or minus sign. No local characters (Chinese, Polish, Greek, Ukrainian…) are allowed. Many other characters are disallowed as well (like `#` or comma or space).

This requirement has to stay – the project **name** is used to determine a lot of internal things, in CGE, and in various tooling (also for Windows manifest, also for Android package). These things only allow a limited set of characters. We already have some non-trivial code to allow even minus (-) everywhere, it’s not that obvious 🙂

That being said, the project **caption** is supposed to be readable for the user, and it dictates a lot of user-visible strings (like application window title on desktop, application name on Android/iOS desktop etc.). And the caption can contain any character (including spaces, commas, any local Chinese or other characters). Note that after changing “caption” in manifest you shall run “Code → Regenerate Project (…)” in editor (or just manually edit `castleautogenerated.pas` to reflect the same change, for now).

So: Please clarify _why_ you would like to put Chinese characters in the project name. If it’s for the user, to make application caption with Chinese characters visible for the user → put it in caption.

---

<div class="post-metadata">

### Author: ![a493203176](https://forum.castle-engine.io/letter_avatar_proxy/v4/letter/a/cc9497/32.png) [@a493203176](https://forum.castle-engine.io/u/a493203176)
#### Post date: [June 17, 2024, 9:04am UTC](https://forum.castle-engine.io/t/cant-chinese-characters-be-set-for-packaging-names/1234/3 "2024-06-17T09:04:22Z")

</div>

![image](https://forum.castle-engine.io/uploads/default/original/2X/7/749a3b4b87c7c5f17c587c7fa2ff38d0d7d30c92.jpeg)  
What I mean is that the app name can be set in Chinese, and compiled into an exe name that can also be set by oneself

---

<div class="post-metadata">

### Author: ![kagamma](https://forum.castle-engine.io/user_avatar/forum.castle-engine.io/kagamma/32/226_2.png) [@kagamma](https://forum.castle-engine.io/u/kagamma)
#### Post date: [June 17, 2024, 4:39pm UTC](https://forum.castle-engine.io/t/cant-chinese-characters-be-set-for-packaging-names/1234/4 "2024-06-17T16:39:23Z")

</div>

I haven’t test it, but perhaps “executable\_name” is what you are looking for. [CastleEngineManifest.xml - Syntax and Examples | Manual | Castle Game Engine](https://castle-engine.io/project_manifest#_basic_project_information)

---

<div class="post-metadata">

### Author: ![a493203176](https://forum.castle-engine.io/letter_avatar_proxy/v4/letter/a/cc9497/32.png) [@a493203176](https://forum.castle-engine.io/u/a493203176)
#### Post date: [June 18, 2024, 8:10am UTC](https://forum.castle-engine.io/t/cant-chinese-characters-be-set-for-packaging-names/1234/5 "2024-06-18T08:10:56Z")

</div>

Tested and not allowed to be used

Exception “Exception”:  
Project executable\_name contains invalid characters: “91M2?ͻ??”, this character is not allowed: “#229”

Command finished with status 1.

---

<div class="post-metadata">

### Author: ![michalis](https://forum.castle-engine.io/user_avatar/forum.castle-engine.io/michalis/32/3_2.png) [@michalis](https://forum.castle-engine.io/u/michalis)
#### Post date: [June 18, 2024, 11:13am UTC](https://forum.castle-engine.io/t/cant-chinese-characters-be-set-for-packaging-names/1234/6 "2024-06-18T11:13:39Z")

</div>

> [@a493203176](#):
>
> ![image](https://forum.castle-engine.io/uploads/default/original/2X/7/749a3b4b87c7c5f17c587c7fa2ff38d0d7d30c92.jpeg)
> 
> What I mean is that the app name can be set in Chinese, and compiled into an exe name that can also be set by oneself

To have Chinese application name on the Android/iOS screen, set `caption`, as mentioned in my previous post 🙂 The `caption` determines what is seen there, and it can include any set of characters.

> [@a493203176](#):
>
> Exception “Exception”:  
> Project executable\_name contains invalid characters: “91M2?ͻ??”, this character is not allowed: “#229”

I think we could enable more characters in the executable name, this shall not be a problem. I’ll look into this later today. Any character allowed by the filesystem should be OK there.

---

<div class="post-metadata">

### Author: ![eugeneloza](https://forum.castle-engine.io/user_avatar/forum.castle-engine.io/eugeneloza/32/12_2.png) [@eugeneloza](https://forum.castle-engine.io/u/eugeneloza)
#### Post date: [June 18, 2024, 11:37am UTC](https://forum.castle-engine.io/t/cant-chinese-characters-be-set-for-packaging-names/1234/7 "2024-06-18T11:37:30Z")

</div>

> [@michalis](#):
>
> Any character allowed by the filesystem should be OK there.

Note that ZIP tools have serious limitations on what file names can be packaged. E.g. Windows’ embedded zip simply ignores everything non-ASCII. Linux’s zip library often confuses non-ASCII filenames (and makes them into an unreadable mess) when those were not archived by the same library. 7Zip seems to be the most reliable in extracting such archives, but it’s usually not a good idea to demand end-users to install a better unzipper to handle the downloaded app.

Footnote: since 1991 when I’ve first encountered this problem, naming files using non-ascii symbols (and even some special symbols) is not a good idea, the situation has improved over the years, but not too significantly. Especially in terms of cross-platform filenames, windows-linux-mac (just to mention that Unix filenames can contain symbols like `:` or `\`) first of all, but I’m even scared to think of closed systems like Nintendo Switch or Playstation. So, overall, naming a file (be it executable or asset) in a non-ascii (lower 128 chars) way is in general a bad idea.

---

<div class="post-metadata">

### Author: ![michalis](https://forum.castle-engine.io/user_avatar/forum.castle-engine.io/michalis/32/3_2.png) [@michalis](https://forum.castle-engine.io/u/michalis)
#### Post date: [June 18, 2024, 8:21pm UTC](https://forum.castle-engine.io/t/cant-chinese-characters-be-set-for-packaging-names/1234/8 "2024-06-18T20:21:46Z")

</div>

I enabled `executable_name` to have various characters, including Chinese. The allowed subset should be good for both Windows and Linux modern filesystems (I looked at [filenames - What characters are safe in cross-platform file names for Linux, Windows and OS-X - Super User](https://superuser.com/questions/358855/what-characters-are-safe-in-cross-platform-file-names-for-linux-windows-and-os) ).

Testing, I could build + run application with

```auto
executable_name="样例中文文本"

```

inside `CastleEngineManifest.xml`. The sample executable filename `样例中文文本` seems to survive fine packing + unpacking into zip too. Tested on both Linux and Windows, screenshots at the bottom of this post. Debugging from VS Code (using FpDebug) on Linux also is fine.

But please do heed Eugene’s warnings 🙂 Using a filename with Chinese characters, while allowed now in Castle Game Engine, is still something that may cause issues with some tools down the line. I surely didn’t test everything possible that people may do with files 🙂 You are quite likely saving yourself some future trouble by just using an ASCII name. In the end, the name of your EXE should be internal for users. For Windows, you can create an installer for your application using e.g. [InnoSetup](https://jrsoftware.org/isinfo.php), that will create a nice application icon with any caption on the desktop (which is then independent from the exe name).

 ![obraz](https://forum.castle-engine.io/uploads/default/original/2X/1/134aefdbc7ecdf2fd8f46fe57d6a21bdc13edf7f.png)

 ![obraz](https://forum.castle-engine.io/uploads/default/original/2X/9/967a43c1b246bcecf7b634c016935b26ad7ab37f.png)

---

<div class="post-metadata">

### Author: ![michalis](https://forum.castle-engine.io/user_avatar/forum.castle-engine.io/michalis/32/3_2.png) [@michalis](https://forum.castle-engine.io/u/michalis)
#### Post date: [June 18, 2024, 8:25pm UTC](https://forum.castle-engine.io/t/cant-chinese-characters-be-set-for-packaging-names/1234/9 "2024-06-18T20:25:55Z")

</div>

> [@michalis](#):
>
> I enabled `executable_name` to have various characters, including Chinese.

And as usual, the new engine version with these improvements will be automatically available for download on [Download | Castle Game Engine](https://castle-engine.io/download) once it passes some automatic tests. You can watch [this page](https://github.com/castle-engine/castle-engine/compare/snapshot...master), when it will no longer show the commit titled _" Eliminate UTF8CharacterToUnicode warnings…"_ then everything is included in the download.

I also took this opportunity to cleanup our [CastleUnicode](https://castle-engine.io/apidoc/html/CastleUnicode.html) unit API, simplifying some things and added [TCastleStringIterator](https://castle-engine.io/apidoc/html/CastleUnicode.TCastleStringIterator.html). And added a [few new auto-tests](https://github.com/castle-engine/castle-engine/blob/master/tests/code/testcases/testcastleunicode.pas) to make sure it is OK, also with Chinese characters. So overall the engine is better now, I’m happy 🙂

---

<div class="post-metadata">

### Author: ![a493203176](https://forum.castle-engine.io/letter_avatar_proxy/v4/letter/a/cc9497/32.png) [@a493203176](https://forum.castle-engine.io/u/a493203176)
#### Post date: [June 19, 2024, 6:01am UTC](https://forum.castle-engine.io/t/cant-chinese-characters-be-set-for-packaging-names/1234/10 "2024-06-19T06:01:20Z")

</div>

Thank you.
