Utilities/RB_FputcLatin1ToUtf8 [ Functions ]

NAME

RB_FputcLatin1ToUtf8

SYNOPSIS

 *   void RB_FputcLatin1ToUtf8(FILE *fp, int c)

BUGS

This wrongly assumes that input is always Latin-1.

SOURCE

void RB_FputcLatin1ToUtf8(
    FILE *fp,
    int c )
{
    if ( c < 0x80 )
    {
        if ( fputc( c, fp ) == EOF )
            RB_Panic( "RB_FputcLatin1ToUtf8: write error" );
    }
    else
    {
        if ( fputc( ( 0xC0 | ( c >> 6 ) ), fp ) == EOF )
            RB_Panic( "RB_FputcLatin1ToUtf8: write error" );
        if ( fputc( ( 0x80 | ( c & 0x3F ) ), fp ) == EOF )
            RB_Panic( "RB_FputcLatin1ToUtf8: write error" );
    }
}