Pelles C > Feature requests
printf UTF-8
Robert:
printf UTF-8 ???
Someday ???
Someday soon ???
--- Code: ---
#include<stdio.h>
int main() {
int στάσις = 1;
στάσις++;
printf("%d\n", στάσις);
printf("%s", "δυσκατανοήτων");
return 0;
}
--- End code ---
CLang, GCC 10 output
--- Code: ---
2
δυσκατανοήτων
--- End code ---
Pelles C 10 output
--- Code: ---
2
?????????????
--- End code ---
TimoVJL:
Those use msvcrt.dll
--- Code: ---#include<stdio.h>
#pragma comment(lib, "msvcrt.lib")
void __stdcall ExitProcess(int);
int __stdcall SetConsoleOutputCP(int);
void __cdecl mainCRTStartup(void) {
SetConsoleOutputCP(65001);
ExitProcess(main());
}
int main(void) {
int στάσις = 1;
στάσις++;
printf("%d\n", στάσις);
printf("%s", u8"δυσκατανοήτων\n");
return 0;
}
--- End code ---
--- Code: ---2
δυσκατανοήτων
--- End code ---
John Z:
Hmmmm …. msvcrt.lib/dll is not included with PellesC. You'll need a copy perhaps from MS Visual C, I see that I have it there, in C:\Program Files (x86)\DevStudio\VC\lib
BTW I tried
fwprintf(stderr, L"%ls\n",L"δυσκατανοήτων");
didn't do much better.
John Z
Robert:
Thanks TimoVJL.
I couldn't get your code to work but the following did work 32 and 64 bit.
--- Code: ---
#include<stdio.h>
#include<windows.h>
int main(void) {
SetConsoleOutputCP(65001);
int στάσις = 1;
στάσις++;
printf("%d\n", στάσις);
printf("%s", u8"δυσκατανοήτων");
return 0;
}
--- End code ---
TimoVJL:
@Ropert, console mode is a problem, font have to support more than basic ANSI.
@John Z, msvcrt.lib isn't part of Pelles C, but i was.
https://forum.pellesc.de/index.php?topic=7206.msg32907#msg32907
Navigation
[0] Message Index
[#] Next page
Go to full version