File tree 1 file changed +4
-1
lines changed
1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change 95
95
/// Decode UCS-2 string to UTF-8 with a custom callback function.
96
96
///
97
97
/// `output` is a function which receives every decoded character.
98
+ /// Due to the nature of UCS-2, the function can receive an UTF-8 character
99
+ /// of up to three bytes, for every input character.
98
100
pub fn decode_with < F > ( input : & [ u16 ] , mut output : F ) -> Result < usize >
99
101
where
100
102
F : FnMut ( & [ u8 ] ) -> Result < ( ) > ,
@@ -134,7 +136,8 @@ where
134
136
/// Decode an input UCS-2 string into a UTF-8 string.
135
137
///
136
138
/// The returned `usize` represents the length of the returned buffer,
137
- /// in bytes.
139
+ /// in bytes. Due to the nature of UCS-2, the output buffer could end up with
140
+ /// three bytes for every character in the input buffer.
138
141
pub fn decode ( input : & [ u16 ] , output : & mut [ u8 ] ) -> Result < usize > {
139
142
let buffer_size = output. len ( ) ;
140
143
let mut i = 0 ;
You can’t perform that action at this time.
0 commit comments