• Leo
  • Order of the Butterfly
    Order of the Butterfly
    Posts: 415 from 2003/8/18
    I tried to compile a simple hello world which prints UTF-8 characters using printf():


    #include <stdio.h>

    int main(void) {
    char ver[] = "©«",
    ver2[] = "的",
    ver3[] = "$VER: test caractères: ©«的";

    printf("ver: %sn", ver);
    printf("ver2: %sn", ver2);
    return 0;

    The source file is saved as UTF-8, and I compiled it using gcc file.c -noixemul.

    When I run it in a MorhOS shell, here is what I get instead:


    ver: ©«
    ver2: ç


    Is UTF-8 supported in MorphOS? What encoding should be used to save files with special characters?

    I checked and didn't find any way to specify the encoding used in the Shell or in the OS.

    The same code compiled on Linux or macOS works as expected when executed.

    [ Edited by Leo 08.07.2018 - 11:04 ]
    Nothing hurts a project more than developers not taking the time to let their community know what is going on.
  • »06.07.18 - 08:47
    Profile Visit Website