Skip to main content

from_java_cesu8

Function from_java_cesu8 

Source
pub fn from_java_cesu8(str: &JavaStr) -> Cow<'_, str>
Expand description

Encodes a Converts a JavaStr into a str. We avoid copying unless necessary. In the case where there are no surrogate pairs, then no allocation will happen.

It is theoretically possible to convert a JavaStr into a UTF-8 string without allocation in any case, as the length of a Java CESU-8 string is always greater than or equal to the length of a UTF-8 string. This library does not currently provide this option.