[php-src] Issue #8308: The return value of mb_list_encodings() doesn't contain 'SJIS-win'
| From: | alexdowad | Date: | Sat, 09 Apr 2022 18:01:25 +0000 |
| Subject: | [php-src] Issue #8308: The return value of mb_list_encodings() doesn't contain 'SJIS-win' | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-240816@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/8308
Comment Author: alexdowad
@cmd69, I think you are a Windows man. I'm just wondering if mbstring's definition of
CP932 might have been chosen to agree with the Win32 API. Presumably you have a Windows machine with
VC++?
Are you able to build and run this program? I don't have a Windows machine to do it on. (Please
note, I wrote this code from the Win32 API docs, but can't test it, so it may not work... 😬)
```c
#include <stdio.h>
#include <stringapiset.h>
void TryConversion(int wchar)
{
WCHAR instr[1];
CHAR outstr[32];
instr[0] = wchar;
int num_chars = WideCharToMultiByte(932, 0, instr, 1, outstr, sizeof(outstr), NULL, NULL);
if (num_chars == 0) {
printf("ERROR\n");
return;
}
for (int i = 0; i < num_chars; i++)
printf("%x ", outstr[i] & 0xFF);
printf("\n");
}
int main()
{
TryConversion(0xA5);
TryConversion(0x203E);
return 0;
}
```
A web search suggests that in Visual Studio, when creating a new project for this, you would want to
choose "Windows Desktop", choose "Windows Desktop Wizard", then in the wizard,
pick "Console Application (.exe)" as the "Application Type".