Bring UTF-8 back to x86 kit

Open
#315 41 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
52/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Quiet
Tech stack
c

Research direction

Start by locating the x86 kit integration for utf8.manifest and utf8.rc, then compare it with the conforming manifest and resource definitions shown in the issue. Build the x86 kit and verify that an executable using the manifest reports UTF-8 as its active code page on Windows XP and newer Windows versions.

Written by the indexing model from the issue text.

Description

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

Dominant language
C
Stars
4.8k
Forks
381
Avg merge
45m
Merged PRs (30d)
1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from skeeto/w64devkit

All issues in skeeto/w64devkit

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.