+5

Combining diacritics (accents) not rendering correctly in the buffer

Iain McGinniss 11 years ago updated by Jens Larsson 11 years ago 2

I use the the OS X automator plugin UnicodeIt in order to allow me to type LaTeX amsmath macros to produce unicode characters that are difficult to type otherwise. Attempting to produce a character which uses a combining diacritic (e.g. an accent) in Sublime Text does not work correctly: for instance converting


\overline{\epsilon}


which should produce ε̅ instead produces:


Image 221


This problem is not actually caused by UnicodeIt as far as I can tell, as attempting to paste any of the characters with combining diacritics from this test page causes the same issue. Pasting these characters into a terminal, or TextEdit, produces the desired result:


Image 222


I think this is related to this forum post on display of accents on greek characters in tab titles - the rendering problem looks the same, where the diacritic is separated from the character it is intended to combine with. I notice that if I create a file named ε̅.txt and open it with sublime text, it renders correctly in the tab title:


Image 223


I am using Version 2.0.1, build 2217.


There is a plugin which makes the entry of greek characters with combining diacritics easier, called BetaCode. Looking at its source code, it does the following:

# Unicode normalization, make chars precomposed whenever possible.

 str = unicodedata.normalize('NFKC', str)


I don't know a lot about unicode, but it seems that if pasted text containing unicode were normalised in this fashion then combining diacritics would render correctly, at least in the particular case of greek letters.

+1

I have seen this behavior in other text editors as well. Luckily, it's a presentational problem as the encoding is fine both when when pasting to and copying from the editor in my experience.


Funny enough, there are also editors where it looks fine; both TextMate and Textastic on Mac display the diacritics correctly in combination with e.g. IPA characters. Whether fallback fonts will display those combinations depends on what glyphs are available for the font you currently, use of course. Currently I've only had complete success with Menlo and Courier New in that area.


I find it too cumbersome to read in ST so I'm forced to use TextMate for any task that involves diacritics with special characters.


I would *love* to see this fixed as I work with IPA characters with diacritics on a daily basis (an entire dictionary for a language with no official writing system among other things) but I have no idea whether this is something that can be patched or would take a complete rewrite and/or change of text engine.