@@ -129,8 +129,9 @@ impl<'a> From<&'a str> for Shellwords<'a> {
129 DquoteEscaped => Dquoted,
129 DquoteEscaped => Dquoted,
132+ let c_len = c.len_utf8();
132− if i >= input.len() - 1 && end == 0 {
133+ if i == input.len() - c_len && end == 0 {
133− end = i + 1;
134+ end = i + c_len;
136 if end > 0 {
137 if end > 0 {
@@ -333,4 +334,17 @@ mod test {
333 assert_eq!(Shellwords::from(":o a").parts(), &[":o", "a"]);
334 assert_eq!(Shellwords::from(":o a").parts(), &[":o", "a"]);
334 assert_eq!(Shellwords::from(":o a\\ ").parts(), &[":o", "a\\"]);
335 assert_eq!(Shellwords::from(":o a\\ ").parts(), &[":o", "a\\"]);
339+ fn test_multibyte_at_end() {
340+ assert_eq!(Shellwords::from("𒀀").parts(), &["𒀀"]);
342+ Shellwords::from(":sh echo 𒀀").parts(),
343+ &[":sh", "echo", "𒀀"]
346+ Shellwords::from(":sh echo 𒀀 hello world𒀀").parts(),
347+ &[":sh", "echo", "𒀀", "hello", "world𒀀"]