Mercurial > pidgin
comparison src/protocols/msn/msn.c @ 5191:092b418b5012
[gaim-migrate @ 5556]
truncate non-utf8 friendly names, rather than crashing.
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Tue, 22 Apr 2003 05:39:03 +0000 |
parents | cab5cd204956 |
children | fefad67de2c7 |
comparison
equal
deleted
inserted
replaced
5190:2974e17b3f45 | 5191:092b418b5012 |
---|---|
192 | 192 |
193 char *url_decode(const char *msg) | 193 char *url_decode(const char *msg) |
194 { | 194 { |
195 static char buf[MSN_BUF_LEN]; | 195 static char buf[MSN_BUF_LEN]; |
196 int i, j = 0; | 196 int i, j = 0; |
197 char *bum; | |
197 | 198 |
198 bzero(buf, sizeof(buf)); | 199 bzero(buf, sizeof(buf)); |
199 for (i = 0; i < strlen(msg); i++) { | 200 for (i = 0; i < strlen(msg); i++) { |
200 char hex[3]; | 201 char hex[3]; |
201 if (msg[i] != '%') { | 202 if (msg[i] != '%') { |
207 i++; /* now it's at the end and at the start of the for loop | 208 i++; /* now it's at the end and at the start of the for loop |
208 will be at the next character */ | 209 will be at the next character */ |
209 buf[j++] = strtol(hex, NULL, 16); | 210 buf[j++] = strtol(hex, NULL, 16); |
210 } | 211 } |
211 buf[j] = 0; | 212 buf[j] = 0; |
213 | |
214 if(!g_utf8_validate(buf, -1, (const char **)&bum)) | |
215 *bum = '\0'; | |
212 | 216 |
213 return buf; | 217 return buf; |
214 } | 218 } |
215 | 219 |
216 static char *url_encode(const char *msg) | 220 static char *url_encode(const char *msg) |