fast hanzi to pinyin conversion
Demo, where you can customize hanzi2pinyin
contains simplified and traditional Chinese characters and pinyins with tones.
contains only simplified Chinese characters and pinyins without tones (suitable for users in mainland China).
// Hanzi in $('#hanzi') will convert to pinyin and put to $('#pinyin')
$('#hanzi').hanzi2pinyin({target:'#pinyin'});
// This brings the same effect as above:
$('#pinyin').val($('#hanzi').val().hanzi2pinyin());
// HanZi
alert('汉字'.hanzi2pinyin({'case':'proper',hyphen:''}));
selectors which will contain the results
the hyphens between pinyins
can be lower, upper or proper (title) case
(Note: adding quotes around case is necessary for IE browsers)
you can remove, ignore the Chinese punctuation marks or replace them with corresponding English punctuation marks (?)
you can remove, ignore the fullwidth characters or replace them with corresponding halfwidth characters (?)
displays tones in simple (han-zi), standard (hàn-zì) or numeric (han4-zi4) mode