Skip to Main Content
  • Questions
  • How to send hungarian special characters in an email from a database?

Breadcrumb

Question and Answer

Tom Kyte

Thanks for the question, Zoltán.

Asked: September 26, 2003 - 11:00 am UTC

Last updated: March 24, 2008 - 8:43 am UTC

Version: 8.1.7.4.0

Viewed 10K+ times! This question is

You Asked

I installs several codes in a database but none of them supports national language characters however the database supports.
For example:éáíóuúo


and Tom said...


by default, smtp is 7bit ascii.

See
</code> http://docs.oracle.com/cd/B10501_01/appdev.920/a96612/u_smtp.htm#1000697 <code>

it describes this fact and offers a solution -- using RAW. you would utl_raw.cast_to_raw in your hungarian varchar2 variable and use write_raw_data.

Rating

  (6 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

OTN UTL_SMTP Code Examples

Robert Pang, September 26, 2003 - 1:14 pm UTC

Also check out the UTL_SMTP code examples on OTN. There is one on how to send multibyte emails.

</code> http://otn.oracle.com/sample_code/tech/pl_sql/htdocs/Utl_Smtp_Sample.html <code>

Problem with UTL_SMTP for spanish character

Eduardo, February 08, 2006 - 10:43 am UTC

Hi, I´m using UTL_SMTP for sending html mail but some characters ( like ñ, ', " ) are not displaying correctly. Can you help me?

mesg:=
'Date: ' || TO_CHAR( SYSDATE, 'dd Mon yy hh24:mi:ss' ) || utl_tcp.CRLF ||
'From: ' || from_name || utl_tcp.CRLF ||
'Subject: ' || subject || utl_tcp.CRLF ||
'To: ' || to_name || utl_tcp.CRLF ||
'Mime-Version: 1.0' || utl_tcp.CRLF ||
'Content-Type: text/html; charset=UTF-8'||utl_tcp.CRLF;

utl_smtp.write_data ( conn, mesg );

utl_smtp.write_raw_data(conn, utl_raw.cast_to_raw(UTL_TCP.CRLF||message || utl_tcp.CRLF));



Tom Kyte
February 08, 2006 - 10:58 am UTC

well, you are not really using utf-8 here are you?

you are sending the mail in 7bits and 8bits?? you are using write_data and write_RAW_data? you just use one or the other.

and only if your smtp server is capable of dealing with that (many would expect you to encode this 8bit data using base 64 or something)

Problem with UTL_SMTP for spanish character

Eduardo, February 08, 2006 - 3:28 pm UTC

Hi Tom thanks for your answer and I´ll use write_raw_data in my code but I don´t understand you about 7 or 8 bits.

Tom Kyte
February 09, 2006 - 4:57 am UTC

your extended characters with tildas and such are 8 bit characters, smtp is a 7bit protocol (like US7ASCII, only 7 bits are used). IF your smtp server supports it, it MIGHT be able to take the 8bit data with the write raw data routine, if not you'll have to base64 encode the data (which uses only 7bit characters)

Problem with UTL_SMTP for spanish character

Eduardo, February 09, 2006 - 7:45 pm UTC

Could you provide me an example using the code above?

Thanks a lot.

Tom Kyte
February 10, 2006 - 12:34 pm UTC

the link provided by Robert Pang above does - have you checked out that code sample?

A reader, March 17, 2008 - 4:53 am UTC

Even i am facing the same problem. I have a procedure which sends mail using utl_smtp. Now the problem is , in the mail body, some characters like -, ' are replaced by this "?".

Plz let me know how to resolve this.
Tom Kyte
March 24, 2008 - 8:43 am UTC

please read about the SMTP protocol, we are not doing the replacement - it is. some email servers will break lines at a certain character boundary and put in a line continuation character (a dash or equals sign), they are all supposed to be 7 bit ascii by default and so on.

utl_smtp + special characters in the subject

A reader, April 16, 2009 - 8:16 am UTC

Hi Tom,

I am sending special characters both in Subject and in
the body of the mail. I use utl_smtp.write_raw_data(l_conn,utl_RAW.CAST_TO_RAW(l_data)..

I also specified utl_smtp.WRITE_DATA('Content Type : text/xml characterset=UTF8);

The issue is, i am able to see the content correctly in the body of the mail..But, in the Subject, the special character is appearing as junk

Please help me out.

Thanks & Regards

A.Gopal
gopal_ananthanarayanan@satyam.com