@@ -115,7 +115,6 @@ fn decode(input: &mut Reader, ignore_garbage: bool) {
115
115
num == '+' as u8 || num == '/' as u8 )
116
116
} )
117
117
} else {
118
- to_decode = to_decode. as_slice ( ) . replace ( "\n " , "" ) ;
119
118
to_decode. as_slice ( )
120
119
} ;
121
120
@@ -142,6 +141,7 @@ fn decode(input: &mut Reader, ignore_garbage: bool) {
142
141
fn encode ( input : & mut Reader , line_wrap : uint ) {
143
142
let b64_conf = base64:: Config {
144
143
char_set : base64:: Standard ,
144
+ newline : base64:: Newline :: LF ,
145
145
pad : true ,
146
146
line_length : match line_wrap {
147
147
0 => None ,
@@ -154,14 +154,7 @@ fn encode(input: &mut Reader, line_wrap: uint) {
154
154
} ;
155
155
let encoded = to_encode. as_slice ( ) . to_base64 ( b64_conf) ;
156
156
157
- // To my knowledge, RFC 3548 does not specify which line endings to use. It
158
- // seems that rust's base64 algorithm uses CRLF as prescribed by RFC 2045.
159
- // However, since GNU base64 outputs only LF (presumably because that is
160
- // the standard UNIX line ending), we strip CRs from the output to maintain
161
- // compatibility.
162
- let output = encoded. replace ( "\r " , "" ) ;
163
-
164
- println ( output. as_slice ( ) ) ;
157
+ println ( encoded. as_slice ( ) ) ;
165
158
}
166
159
167
160
fn help ( progname : & str , usage : & str ) {
0 commit comments