2002-04-30 18:24:10 +00:00
|
|
|
#include "fmt.h"
|
|
|
|
#include "textcode.h"
|
|
|
|
#include "haveinline.h"
|
|
|
|
|
2003-09-19 19:08:13 +00:00
|
|
|
unsigned long fmt_quotedprintable(char* dest,const char* src,unsigned long len) {
|
2002-04-30 18:24:10 +00:00
|
|
|
register const unsigned char* s=(const unsigned char*) src;
|
|
|
|
unsigned long written=0,i;
|
|
|
|
for (i=0; i<len; ++i) {
|
|
|
|
if (s[i]&0x80 || s[i]=='=') {
|
|
|
|
if (dest) {
|
|
|
|
dest[written]='=';
|
2003-09-19 19:08:13 +00:00
|
|
|
dest[written+1]=fmt_tohex(s[i]>>4);
|
|
|
|
dest[written+2]=fmt_tohex(s[i]&15);
|
2002-04-30 18:24:10 +00:00
|
|
|
}
|
|
|
|
written+=3;
|
|
|
|
} else {
|
|
|
|
if (dest) dest[written]=s[i]; ++written;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return written;
|
|
|
|
}
|