bug-gtypist
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gtypist] gtypist fails to load with iconv error (OSX 10.11.6)


From: Felix Natter
Subject: Re: [bug-gtypist] gtypist fails to load with iconv error (OSX 10.11.6)
Date: Tue, 02 May 2017 19:18:27 +0200
User-agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.4 (gnu/linux)

Javier Jarava <address@hidden> writes:

> Hi!

hello Javier,

> After managing to get ncursesw compiled in OSX, I’ve managed to compile and 
> install gtypist

I will reply to the native curses compilation issue soon.

> OSX Version:
>
> ProductName:    Mac OS X  
> ProductVersion: 10.11.6  
> BuildVersion:   15G1421
>
> When I launch it with gtypist on the command line, it doesn’t work, but the 
> command TERMINFO=/usr/share/terminfo gtypist works…
>
> The problem is when I try to load Spanish lessons:
>
> I get:
>
> 2017-04-30 22:02:42 address@hidden:~ $ TERMINFO=/usr/share/terminfo gtypist 
> esp.typ
> gtypist: line 19: iconv() failed on 'B:Lecciones de manejo de teclado en 
> español para GNU Typist': Illegal byte sequence
> You should probably use a UTF-8 locale for the selected lesson!
> :
> ?
>
> The current LOCALE is:
>
> 2017-04-30 22:07:22 address@hidden:~ $ LOCALE  
> LANG=  
> LC_COLLATE="C"  
> LC_CTYPE="UTF-8"  
> LC_MESSAGES="C"  
> LC_MONETARY="C"  
> LC_NUMERIC="C"  
> LC_TIME="C"  
> LC_ALL=
>
> But even tweaking the system configuration so that the LOCALE is set to 
> es_ES.UTF-8, I have errors:
>
> 2017-04-30 22:08:16 address@hidden:~ $ LOCALE
> LANG="es_ES.UTF-8"
> LC_COLLATE="es_ES.UTF-8"
> LC_CTYPE="es_ES.UTF-8"
> LC_MESSAGES="es_ES.UTF-8"
> LC_MONETARY="es_ES.UTF-8"
> LC_NUMERIC="es_ES.UTF-8"
> LC_TIME="es_ES.UTF-8"
> LC_ALL=
>  2017-04-30 22:08:17 address@hidden:~ $ TERMINFO=/usr/share/terminfo gtypist 
> esp.typ
> gtypist: line 19: iconv() failed on 'B:Lecciones de manejo de teclado en 
> español para GNU Typist': Illegal byte sequence
> You should probably use a UTF-8 locale for the selected lesson!
> :
> ?
>  2017-04-30 22:08:21 address@hidden:~ $ 
>
> What might be the issue here? This is making gtypist unfit for what I need it 
> for.

Your problem is that GTypist does not detect that you are using a UTF-8
locale, thus it tries to convert the lesson to your local locale.
(in convertUTF8ToCurrentEncoding(), see snipped below).

------------------------------------------
int utf8len(const char* UTF8Text)
{
    if (isUTF8Locale)
    {
#ifdef MINGW
        return MultiByteToWideChar(CP_UTF8, 0, UTF8Text, -1, NULL, NULL) - 1;
#else
        return mbstowcs(NULL, UTF8Text, 0);
#endif
    }
    else
    {
        /* the behavior of mbstowcs depends on LC_CTYPE!  That's why
           we cannot use mbstowcs() for non-utf8 locales */
        char* textWithCurrentEncoding = convertUTF8ToCurrentEncoding(UTF8Text);
        int len = strlen(textWithCurrentEncoding);
        free(textWithCurrentEncoding);
        return len;
    }
}
------------------------------------------

I think the problem is that the es_ES.UTF-8 locale is not installed on
your system. Could you please check?

If that doesn't help, here is the code that detects the encoding
(src/gtypist.c):
------------------------------------------
#ifdef MINGW
  locale_encoding = "UTF-8";
#else
  locale_encoding = nl_langinfo(CODESET);
#endif
  isUTF8Locale = strcasecmp(locale_encoding, "UTF-8") == 0 ||
      strcasecmp(locale_encoding, "UTF8") == 0;
  /* printf("encoding is %s, UTF8=%d\n", locale_encoding, isUTF8Locale); */
------------------------------------------

--> can you recompile with the printf line not commented out (remove /*
and */)?

Cheers and Best Regards,
-- 
Felix Natter



reply via email to

[Prev in Thread] Current Thread [Next in Thread]