Given a source text like
nin2 hao3 ma
(which is a typical way to write ASCII Pinyin, without proper accentuated characters) and given a (UTF8) conversion table like
a1;ā
e1;ē
i1;ī
o1;ō
u1;ū
ü1;ǖ
A1;Ā
E1;Ē
...
how would I convert the source text into
nín hǎo ma
?
For what it's worth I'm using PHP, and this might be a regex I'm looking into?