I need to convert Java Strings to ISO/IEC 8859-1 in order to save space/make every character use 1 byte.
However, when using
getBytes(StandardCharsets.ISO_8859_1)
some characters like š
and ž
are later printed as ?
. They are not part of ISO/IEC 8859-1, but I would like to have an automatic way to adequately replace these letters like: š-->s
, ž-->z
, for every letter of UTF-16 that is not part of ISO/IEC 8859-1.
Is such a thing possible?
EDIT: I used a solution by Erick Robertson.