i wrote the code using PLSQL Oracle, how send mails via Microsft Graph API, after creating the json structure to send via https (using JSON_OBJECT_T classes in plsql), im having troubles when in the body or the subject of the mail im using characters that are a bit more special, like : òàù and probably others of this type. Now the CHARSET of my database for varchar2 is WE8MSWIN1252, while for nvarchar2 is AL16UTF16. Now i kow that Microsoft Grap accepts just utf-8. The code im posting, works fine and sends the email if there are no special characters like the ones i wrote just before, but if i add them i get error: 400 Bad Request. Im not sure what is the problem, it might be something about the Content Length or probably something about the Encoding itself of the characters. In the request header i put application/json and i also used the function UTL_HTTP.SET_BODY_CHARSET('UTF-8');. Any help, please? Im posting just the code for the sending of the json itself, if you need any other pieces then i can add them to the question. Thank you in advance for the help.
The code:
v_clob := v_json_full_message.to_clob;UTL_HTTP.set_header(v_request, 'Content-Length', DBMS_LOB.getlength(v_clob));WHILE v_offset \<= DBMS_LOB.getlength(v_clob) LOOP DBMS_LOB.read(v_clob, v_chunk_size, v_offset, v_buffer); UTL_HTTP.write_text(v_request, v_buffer); m3log.error(v_buffer); v_offset := v_offset + v_chunk_size;END LOOP;v_response := UTL_HTTP.get_response(v_request);m3log.error('Response Status: ' || v_response.status_code);m3log.error('Response Reason: ' || v_response.reason_phrase);UTL_HTTP.end_response(v_response);
I tried different approaches, but i cannot seem to understand whats the problem. Im lacking a bit of the understanding of the character encodings in the utl_http package itself.