Click here to Skip to main content
15,903,362 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
Hi!
I need, for an application that uses phonetic characters, to be able to have letters with diacritics that are not in the Unicode Tables, such as "w" with a tilde, or the latin "a" turned with a tilde. I've seen here, in CodeProject ("http://www.codeproject.com/Questions/175452/Dynamicly-add-diacritics-to-characters"), an answer that could resolve my problem, but I've tried making an adjust to the class that that example uses and test the letter "w" with a tilde, but it didn't produces the result. Curiously "w" with "^" is ok. I can't understand why. Is there a way to add any discritic to any letter?

Thanks
Antonio Barros

What I have tried:

I've seen here, in CodeProject ("http://www.codeproject.com/Questions/175452/Dynamicly-add-diacritics-to-characters"), an answer that could resolve my problem, but I've tried making an adjust to the class that that example uses and test the letter "w" with a tilde, but it didn't produces the result. Curiously "w" with "^" is ok.
Posted
Updated 26-Mar-16 9:10am

In addition to Windows standard font encoding (Unicode) providing many characters that can be used for phonetic representations, there are special fonts for phonetic representation; I suggest you use one of those: [^] :
C#
Phonetic Fonts for Windows
Thanks to the introduction of Unicode, recent Windows computers come ready-equipped with phonetic symbols. See http://www.phon.ucl.ac.uk/home/wells/ipa-unicode.htm

The best Windows fonts for general use appear to be Times New Roman, Arial, Courier New, and Segoe UI. The versions supplied with Windows 7 and 8 include all the symbols on the IPA Chart. Other useful fonts are available for free download from www.sil.org.

"
 
Share this answer
 
Comments
Antonio Barros 26-Mar-16 13:35pm    
Thanks for your tip. I already know the IPA code tables. The problem is that I couldn't find in any code table the letter "a" turned with a tilde or "w" with a tilde, but I think that it could be possible to "male them". The CodeProject answer in http://www.codeproject.com/Questions/175452/Dynamicly-add-diacritics-to-characters" is something but I couldn't understand why is not functioning with the letter "w".
Thanks again.
This is how:
For example, 'w' with diacritical circumflex accent: ŵ; with tilde: w̃.

Those characters are produced as small 'w' followed by combined diacritical marks circumflex accent and tilde, code points 0x0302 and 0x0303, respectfully.

First of all, don't mess it up: followed by the diacritic, not prefixed by. Also, remember that in little-endian (internal representation of .NET string is UTF-16LE) lower byte comes first; 0x0302 and 0x0303 code point come in the byte order 2, 3, 3, 3. However, the function System.Text.Encoding.GetBytes and System.Text.Encoding.GetChars take care of that: Encoding Class (System.Text)[^].

If you don't want to insert Unicode text in code files, these functions are useful:
Char.ConvertFromUtf32 Method (Int32) (System)[^],
Char.ConvertToUtf32 Method (Char, Char) (System)[^].

Here, its important to understand: UTF-32 is the only UTF which represents a character as the word numerically equal to the Unicode code point. It does not work with .NET characters but with .NET strings or pairs of characters. This is because .NET characters are not always really characters: some represent either low or high surrogate from a surrogate pair, so a "real" Unicode character (beyond BMP) is represented as two .NET characters.

See also:
UTF-16 — Wikipedia, the free encyclopedia ( for surrogate pairs),
Universal Character Set characters — planes — Wikipedia, the free encyclopedia (for BMP).

(Don't get me wrong: the diacritical marks have nothing to do with surrogate pairs; with the diacritical, you only use BMP, unless the "main" character code point is beyond it. I wrote previous character to explain the purpose of .NET UTF-32 functions which are not well explained my Microsoft MSDN help.)

—SA
 
Share this answer
 
v4
Comments
BillWoodruff 27-Mar-16 8:54am    
+5 absurd down-vote countered. this content is excellent !

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900