Anna Stasinopoulou
Anna Stasinopoulou

Reputation: 23

Convert non-ASCII email addresses to punycode in java

I am new to developing and I have the following task.

I need to be able to able write and retrieve from my database international email addresses, i.e. addresses that contain non-ascii characters like æ, ø, å, ö, ä, ß, ü. In order to do this I need to convert the email address to punycode if I have understood correctly.

Is there an easy way to do this in java?

Upvotes: 0

Views: 477

Answers (1)

arnt
arnt

Reputation: 9685

You don't generally need to convert the address to punycode, no. You definitely can use the human-readable form both when formatting email messages (here's an example of a valid email message, note the ø) and when sending mail.

IDN conversion is necessary in order to perform an MX lookup as part of locating the recipient's mail server, but that task is typically performed by your outgoing mail server. The software you are writing should be able to assume that all the addresses use UTF-8 everywhere, and all the world is simple.

Upvotes: 1

Related Questions