It is easy but let me explain the possible logic of Oracle:
Character data are stored in database encoding by default. If you want to specify encoding then probable it is different from database encoding. OK, Let it be BLOB, i.e. octet stream represented in desired encoding. So we should use XMLSERIALIZE function to create representation in any encoding (including the default DB encoding as well)
select
xmlserialize(document xmltype('<Envelop>Any UTF charachers. Tous les caractères UTF. כל תווי UTF </Envelop>') as blob encoding 'UTF-8' version '1.0')
from dual;
If your default DB encoding is UTF-8 then you can also wrap this call into to_clob(…)
or even to_char(…)
to see the result. For me
select
to_char(xmlserialize(document xmltype('<Envelop>Any UTF charachers. Tous lescaractères UTF. כל תווי UTF </Envelop>') as blob encoding 'UTF-8' version '1.0'))
from dual;
Gives:
<?xml version="1.0" encoding="UTF-8"?>
<Envelop>Any UTF charachers. Tous les caractères UTF. כל תווי UTF </Envelop>