Skip to content

AddShortCut does not correctly handle non-ASCII characters in shortcut names in PhoenixPE #214

Backlog

Description

@lkydev

Checklist

Report

Describe what is happening
I tried to write my own script but AddShortCut did not handle shortcut names with non-ASCII characters.

PhoenixPE vesion: 2026.10.25.

To Reproduce

  1. Configure Source Config to make sure Windows 10/11 setup source is available.
  2. Just accept the defaults and build an image once.
  3. Go to Finalize → TweakBox, click Edit Codebox.
  4. When a text editor opens, under [Process] section, add these two lines:
AddShortcut,StartMenu,"Productivity","Test shortcut","#$pWinDir#$p\System32\cmd.exe",""
AddShortcut,StartMenu,"Productivity","命令提示字元","#$pWinDir#$p\System32\cmd.exe",""
  1. Here 命令提示字元 is just the Traditional Chinese translation for "Command Prompt".
  2. Save the file, close the text editor, and returns to PhoenixPE.
  3. Click the Execute button.
  4. It seems that the shortcuts are not created immediately, instead they are recorded in <P>\Workbench\PhoenixPE\Target\Windows\System32\PhoenixPE.au3 and are created on the fly when booting the rescue iso. (<P> is the folder containing PhoenixPE).
  5. Use a text editor to open <P>\Workbench\PhoenixPE\Target\Windows\System32\PhoenixPE.au3.
  6. Go to the CreateShortcuts() function.
  7. The last two lines correspond to the shortcuts I want to make.
  8. The first is correct.
  9. The second line reads MakeShortcut('%WinDir%\System32\cmd.exe', @StartMenuCommonDir & "\Programs" & '\Productivity\??????.lnk', '', '', '', '', '', 0, @SW_SHOWNORMAL), which is incorrect - it should not be six ? marks. It should be 命令提示字元.
  10. So I would like to report that shortcut names containing non-ASCII characters are not correctly saved to <P>\Workbench\PhoenixPE\Target\Windows\System32\PhoenixPE.au3.

Activity

  1. homes32 commented on Dec 3, 2026

    @homes32
    Contributor

    Confirmed. Thanks for reporting. The issue is caused by the fact that PhoenixPE.au3 is UTF8 without BOM and does not contain any wide characters (technically its 100% valid ANSI and UTF-8) so PEBakery's TextReplace command plays it safe and treats unmarked files as ANSI and applies the hosts codepage unless the file has a BOM or already contains unicode characters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions