Java Spring: Display Chinese Characters in Email

May 26, 2015
My current task is to implement localization for a website.

There is no issue with displaying the Chinese characters in the website.

However, I just have one problem: Chinese characters appear as question mark in emails.
Already set the encoding to UTF-8 but it still won't work.

I did some research and come up with these links:

Fortunately, my team leader eventually got the solution.

In the config file, we just had to add this property for the JavaMail bean.

<property name="defaultEncoding" value="UTF-8"/>

And tadaan! Works like magic :D


Read more ...

Localize jQuery Validate

May 20, 2015
Here is a code snippet on how to localize the custom error messages for the jQuery Validation Plugin, assuming I have already imported the proper libraries.

I have created a separate function in my script to set the proper error messages.

function addCustomMessages(){
    $("#inputName").rules("add", {
        messages: {
            required: errorRequired,
            minlength: errorMinLength
        }
    });
}

where errorRequired and errorMinLength are global variables that holds the localized messages.

The function will be called every time the language is changed.

$("#languageSelector").change(function(){
 // code here to get the translations
 addCustomMessages(); // code that will load the messages for the jQuery validation plugin
});

Works like magic. :)

I'll try to add a fiddle next time to further clarify.

Other helpful links:


Read more ...