I have encoded values in the table, and wanted to select them as a plain text without altering the database property,
I have tried many ways, but not getting exact result.
Value - Er tręäńgt keinen Manteł
Expected - Er treangt keinen Mantel
SELECT 'Er tręäńgt keinen Manteł', 'Er tręäńgt keinen Manteł'::bytea;
SELECT 'Er tręäńgt keinen Manteł', convert_to('Er tręäńgt keinen Manteł', 'utf-8');
Any suggestion will be helpful
CodePudding user response:
You may use the unaccent function of the unaccent
extension.
First create the extension (if not there already). It is included in the EDB installation package.
CREATE EXTENSION unaccent;
and then remove the diacritics
SELECT
'Er tręäńgt keinen Manteł' as accented,
unaccent('Er tręäńgt keinen Manteł') as unaccented;
accented | unaccented |
---|---|
Er tręäńgt keinen Manteł | Er treangt keinen Mantel |
I assume that the original character set is UTF8.