Changed behavior when using encoding to not fail on improperly encoded

text.
This commit is contained in:
Aaron Weiss 2014-12-17 01:31:24 -05:00
parent 5a77845691
commit 467559b478
2 changed files with 3 additions and 3 deletions

View file

@ -1,7 +1,7 @@
[package]
name = "irc"
version = "0.5.6"
version = "0.5.7"
description = "A simple, thread-safe IRC client library."
authors = ["Aaron Weiss <aaronweiss74@gmail.com>"]
license = "Unlicense"

View file

@ -108,7 +108,7 @@ impl<T: IrcReader, U: IrcWriter> Connection<T, U> {
detail: Some(format!("Invalid decoder: {}", encoding))
})
};
let data = match encoding.encode(message.into_string()[], EncoderTrap::Strict) {
let data = match encoding.encode(message.into_string()[], EncoderTrap::Replace) {
Ok(data) => data,
Err(data) => return Err(IoError {
kind: IoErrorKind::InvalidInput,
@ -143,7 +143,7 @@ impl<T: IrcReader, U: IrcWriter> Connection<T, U> {
})
};
self.reader.lock().read_until(b'\n').and_then(|line|
match encoding.decode(line[], DecoderTrap::Strict) {
match encoding.decode(line[], DecoderTrap::Replace) {
Ok(data) => Ok(data),
Err(data) => Err(IoError {
kind: IoErrorKind::InvalidInput,