2 Copyright (C) 2000-2006 SKYRIX Software AG
3 Copyright (C) 2006 Helge Hess
5 This file is part of SOPE.
7 SOPE is free software; you can redistribute it and/or modify it under
8 the terms of the GNU Lesser General Public License as published by the
9 Free Software Foundation; either version 2, or (at your option) any
12 SOPE is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
15 License for more details.
17 You should have received a copy of the GNU Lesser General Public
18 License along with SOPE; see the file COPYING. If not, write to the
19 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
23 #ifndef __NGExtensions_NGQuotedPrintableCoding_H__
24 #define __NGExtensions_NGQuotedPrintableCoding_H__
26 #import <Foundation/NSString.h>
27 #import <Foundation/NSData.h>
28 #include <NGExtensions/NGExtensionsDecls.h>
31 Quoted Printable encoder/decoder
33 As specified in RFC 822 / 2045 / 2047. Note that 2045 and 2047 specify
34 different variants (Q vs content-transfer-encoding)
36 TODO: explain what it does. It doesn't seem to decode a full line like
37 "=?iso-8859-1?q?Yannick=20DAmboise?="
38 but only turns "=20D" style encodings to their charcode.
40 Note: apparently sope-mime contains a category on NSData which provides a
41 method to decode the full value:
42 -decodeQuotedPrintableValueOfMIMEHeaderField:
46 @interface NSData(QuotedPrintableCoding)
49 Decode a quoted printable encoded data. Returns nil if decoding failed. The
50 first method does the RFC 2047 variant, the second RFC 2045 (w/o _ replacing)
52 - (NSData *)dataByDecodingQuotedPrintable;
53 - (NSData *)dataByDecodingQuotedPrintableTransferEncoding;
56 Decode data in quoted printable encoding. Returns nil if encoding failed.
58 - (NSData *)dataByEncodingQuotedPrintable;
63 /* Note: you should avoid NSString methods for QP, its defined on byte level */
64 @interface NSString(QuotedPrintableCoding)
66 - (NSString *)stringByDecodingQuotedPrintable;
67 - (NSString *)stringByEncodingQuotedPrintable;
72 NGExtensions_EXPORT int
73 NGEncodeQuotedPrintable(const char *_src, unsigned _srcLen,
74 char *_dest, unsigned _destLen);
75 NGExtensions_EXPORT int
76 NGDecodeQuotedPrintable(const char *_src, unsigned _srcLen,
77 char *_dest, unsigned _destLen);
78 NGExtensions_EXPORT int
79 NGDecodeQuotedPrintableX(const char *_src, unsigned _srcLen,
80 char *_dest, unsigned _destLen,
81 BOOL _replaceUnderline);
83 #endif /* __NGExtensions_NGQuotedPrintableCoding_H__ */