Skip to content

force utf option #2282

@mc-butler

Description

@mc-butler

Important

This issue was migrated from Trac:

Origin https://midnight-commander.org/ticket/2282
Reporter zyxmon (zyxmon@….com)

I have arm based nas (synology ds110j), that does not support locales but stores files in uft-8.
The sample program

#include <langinfo.h>
#include <locale.h>
#include <stdio.h>

int
main (int argc, char *argv[])
{
    setlocale (LC_ALL, "");
    printf ("%s\n", nl_langinfo (CODESET));
    return 0;
}

always returns ANSI_X3.4-1968

To make mc correctly work with utf-8 on this system I've made changes in 2 files:
1) In lib/strutil/strutil.c
I've changed

return (nl_langinfo (CODESET));

to

return "UTF8";

2) In lib\tty\tty-slang.c
I've changed

SLutf8_enable (-1); 

to

SLutf8_enable (1); 

These changes force utf-8 support in mc on my system.
I think these changes can be made an option in future releases in mc for such systems.

PS Many thanks to il.smind, who helped my to find this solution.

Note

Original attachments:

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: ttyInteraction with the terminal, screen librariesprio: lowMinor problem or easily worked around

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions