Re: How to find a character which can’t be stored in a MySQL “utf8” column in Java
Posted by: Filipe Silva
Date: July 02, 2019 03:49PM

It seems that you are on the right track. Personally, I would change this piece of code a little bit:

Set<String> findProblematicStrings(String input) {
return input.codePoints() // get Unicode code points
.filter(Character::isSupplementaryCodePoint) // filter BMP characters
.mapToObj(Character::toChars) // convert code points into char[]
.map(String::new) // convert char[] into Strings
.collect(Collectors.toSet());
}

But it does exactly the same as yours.

Options: ReplyQuote


Subject
Written By
Posted
Re: How to find a character which can’t be stored in a MySQL “utf8” column in Java
July 02, 2019 03:49PM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.