How to transfer non western languages content such as Arabic and Cyrillic from the Java HTML Editor to CLOB in Oracle Forms easily without encoding issues

To transfer non western languages content such as Arabic and Cyrillic from the Sferyx Java HTML Editor to CLOB in Oracle Forms easily without encoding issues is sufficient to use the method setDontConvertCharacters and set it to true - at this point all non western characters will be escaped as entities and can be transferred safely with any encoding and saved to CLOB datadbase field. Once saved in this format they can be retrieved and displayed without any issues.

DECLARE

bean varchar2(200):='HTMLEDITOR_AREA';
t_id number(20):=1;
hArgs FBEAN.ARGLIST;
parts number(20);
part varchar2(32500);
body_length number(20);
r_hd clob := null;
res_hd clob;
part_size binary_integer := 4000;
pos number(20);
old_length number(20);
last_part_size binary_integer;
BEGIN

hArgs := FBEAN.CREATE_ARGLIST;

FBEAN.ADD_ARG(hArgs,true);
FBean.Invoke(bean,1,'setDontConvertCharacters',hArgs);  -- This line will set the escaping of the non western characters so they can be transferred and rendered correctly with any encoding
FBean.Invoke(bean,1,'setEmbedAllImagesInsideTheDocument',hArgs); -- This line will embed all images inside the document as strings so you should non take care anymore about the images separately
FBEAN.CLEAR_ARGLIST(hArgs);

body_length := FBean.Invoke_num(bean,1,'getBodyContentLenght');
parts := trunc(body_length / part_size);
DBMS_LOB.CREATETEMPORARY(r_hd,TRUE);


-- Complete partsts
if parts > 0 then

for i in 1..parts loop
hArgs := FBEAN.CREATE_ARGLIST;
pos := ((i-1)*part_size);
fbean.add_arg(hargs,pos);
fbean.add_arg(hargs,part_size);
part := fbean.invoke_char(bean,1,'getBodyContentPortion',hargs);
dbms_lob.write(r_hd,part_size,pos+1,part);
end loop;

-- Last part
hArgs := FBEAN.CREATE_ARGLIST;
pos := pos + part_size;
last_part_size := body_length - (parts) * part_size;
fbean.add_arg(hargs,pos);
fbean.add_arg(hargs,last_part_size);
part := fbean.invoke_char(bean,1,'getBodyContentPortion',hargs);
dbms_lob.write(r_hd,last_part_size,pos+1,part);
else
hArgs := FBEAN.CREATE_ARGLIST;
fbean.add_arg(hargs,0);
fbean.add_arg(hargs,body_length);
part := fbean.invoke_char(bean,1,'getBodyContentPortion',hargs);
dbms_lob.write(r_hd,length(part),1,part);
end if;

update EPM_CONTRACT_CONS set ASSUMPTION_DESC = r_hd where EMP_NO = t_id;
DBMS_LOB.FREETEMPORARY(r_hd);
COMMIT;

END;