Changeset b40e60d for lib


Ignore:
Timestamp:
2010-07-29T08:57:01Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
2fe5eb9
Parents:
3963fdd
Message:

Fixing http_encode(): BitlBee now calls setlocale() (for nickname
transliteration to work), which changes the behaviour of isalpha() (turns
out it's not a simple macro). For HTTP-encoding, this sucks, especially
when doing OAuth (which is very picky about the way HTTP encoding is done).
This should fix problems some people were seeing with posting Twitter
messages containing accents.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/misc.c

    r3963fdd rb40e60d  
    305305        for( i = j = 0; t[i]; i ++, j ++ )
    306306        {
    307                 if( !isalnum( t[i] ) && !strchr( "._-~", t[i] ) )
     307                /* Warning: isalnum() is locale-aware, so don't use it here! */
     308                if( ( t[i] >= 'A' && t[i] <= 'Z' ) ||
     309                    ( t[i] >= 'a' && t[i] <= 'z' ) ||
     310                    ( t[i] >= '0' && t[i] <= '9' ) ||
     311                    strchr( "._-~", t[i] ) )
     312                {
     313                        s[j] = t[i];
     314                }
     315                else
    308316                {
    309317                        sprintf( s + j, "%%%02X", ((unsigned char*)t)[i] );
    310318                        j += 2;
    311                 }
    312                 else
    313                 {
    314                         s[j] = t[i];
    315319                }
    316320        }
Note: See TracChangeset for help on using the changeset viewer.