Skip to content

Bring UTF-8 back to x86 kit #315

@CyanoHao

Description

@CyanoHao

The UTF-8 feature was disabled in x86 kit because Windows XP won't load exe files with the UTF-8 manifest. (#58)

After some investigation, I dramatically found that Microsoft gave a non-conforming manifest in their document for UTF-8 code page.

The correct info is available here. With the conforming manifest, the exe does work on Windows XP.

utf8.manifest

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1"
          xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
  <asmv3:application>
    <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2019/WindowsSettings">
      <activeCodePage>UTF-8</activeCodePage>
    </asmv3:windowsSettings>
  </asmv3:application>
</assembly>

utf8.rc

#include <winuser.h>
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "utf8.manifest"

test.c

#include <stdio.h>
#include <windows.h>
int main()
{
  printf("Current code page: %u\n", GetACP());
}

To compile:

windres utf8.rc -O coff -o utf8.o
gcc test.c utf8.o -o test.exe

Windows 10

Windows XP

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions