bug in printing chars with utf8 format

View: New views
2 Messages — Rating Filter:   Alert me  

bug in printing chars with utf8 format

by Miguel Hernandez :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Greetings!
Hope you don't mind if I write you in Spanish, i even think you'll be
glad if I do.

Le escribo para comunicarle un posible bug a la hora de imprimir
caracteres (la función print de Character) en formato UTF8 ya que en mi
máquina (Linux HAL9000 2.6.16.13-4-default #1 Wed May 3 04:53:23 UTC
2006 i686 athlon i386 GNU/Linux con SuSE 10.1, kde3.5, ejecutando desde
konsole) al establecer la opción -F utf8 imprime guiones en lugar de
caracteres. Creo además haber encontrado un workaround al problema,
sustituyendo el código del case utf8 por lo siguiente:

 case Control::utf8:
        //std::fputs( UCS::ucs_to_utf8( gv[0].code ), control.outfile );
          { char* s = UCS::ucs_to_utf8( gv[0].code );
            if( s ) {
                std::fprintf( control.outfile, s );
            }
        }
          break;
      }

sé que es quizá poco elegante, pero a mí me funciona.
En adelante si le parece bien y obtengo los resultados que espero con mi
proyecto (personal-autodidacta) le enviaré algunas otras modificaciones
(aunque puede que antes le pregunte alguna duda).

Un saludo!


_______________________________________________
Bug-ocrad mailing list
Bug-ocrad@...
http://lists.gnu.org/mailman/listinfo/bug-ocrad

Re: bug in printing chars with utf8 format

by Bugzilla from ant_diaz@teleline.es :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Miguel.

Miguel Hernandez wrote:
> Hope you don't mind if I write you in Spanish, i even think you'll be
> glad if I do.

In my personal mail yes. But this list is read by many people and is
supposed to be in English.


> Le escribo para comunicarle un posible bug a la hora de imprimir
> caracteres (la función print de Character) en formato UTF8 ya que en mi
> máquina (Linux HAL9000 2.6.16.13-4-default #1 Wed May 3 04:53:23 UTC
> 2006 i686 athlon i386 GNU/Linux con SuSE 10.1, kde3.5, ejecutando desde
> konsole) al establecer la opción -F utf8 imprime guiones en lugar de
> caracteres.

I didn't manage to reproduce the bug. And given that the function
`UCS::ucs_to_utf8' can never return a null pointer, I can't see why your
workaround works and the original code doesn't, except if the problem is
a compiler or library bug (because of the change fputs<-->fprintf).

- Did you try to compile ocrad as distributed with more than one gcc
version?
- What version(s) of gcc did you use?
- Did you try some other changes to the code?


Regards.
Antonio.


_______________________________________________
Bug-ocrad mailing list
Bug-ocrad@...
http://lists.gnu.org/mailman/listinfo/bug-ocrad