When I paste a special character, from the Character Map, into Gedit or medit in Ubuntu 16.04, then the space characters directly after the special character display with a "compressed" character spacing.


  1. After some leading TABS, I type:

    A     >     B
  2. I then copy-paste that line below to duplicate
  3. If I now replace the > typed character with by pasting over
  4. I get this:

    sample image of the problem

    You can see that the spaces after the have shrunk/compressed.

  5. If I delete the character, then the spaces go back to normal character width

    sample image of the problem test

Additional behaviour noted:

  • If I start a new line with a "non-space character", and paste the , then the leading spaces are not affected
  • If I start a new line with spaces, and paste the , then the leading spaces are also affected

    sample image of the problem more


  1. The usual:

    • google searching
    • AskUbuntu search
    • StackOverflow searching
  2. I used this Unicode to Java string literal converter and my spaces after the are still spaces - nothing funny happening there.

  3. I made sure that I set the character set and font size in the Character Map to the same as my Gedit font settings.

    This shouldn't make any difference - I know - but I did it for the sake of a sanity check.

  4. Saved the Gedit content into a properly formatted HTML file and viewed in Chrome:
    Character spacing normal - as expected
  5. Copy/pasted Gedit content into a blank cell in LibreOffice Calc:
    Character spacing normal - as expected

This is driving me crazy.

Any ideas as to why this is happening?


I have logged a bug report:

  • @guntbert : Noted, thanks. Guilty of posting an issue instead of posing a question. Changed the title and asked a proper question in the body. – TaoRich Dec 14 '17 at 14:53

It's a bug

Gedit's support for higher Unicode characters is not perfect. Understand that what you see in gedit is not necessarily what you get in another app. Gedit is a fun and useful little app, but it's not perfect.

I bet a bug is already reported. Maybe it's one of these? https://bugzilla.gnome.org/buglist.cgi?quicksearch=product%3A%22gedit%22%20utf-8&list_id=272617

I don't see one that matches what you're saying. Maybe you can report a new bug by following these steps: https://wiki.gnome.org/Apps/Gedit/ReportingBugs

If you're writing code, try IntelliJ or another more serious editor. Even vim might do better. I tested and your sample works perfectly in both of those.

3-byte UTF-8 character

You're using a 3-byte UTF-8 character:


I ran xxd on a test file created by gedit - Version 3.22.1. xxd V1.10 27oct98 by Juergen Weigert did not display the character correctly either, but cat (GNU coreutils) 8.26 did.

So, let's go through the laborious process of translating the UTF-8 encoding into the Unicode character it represents.

Hx Binary
e2 1110 0010
af 1010 1111
88 1000 1000

Strip off the controls (each ends with a 0):

Ctr  Actual bits  Ctrl Meaning
1110 0010         1110 means: a three-byte character.
10   101111       10 means: continuation of character.
10   001000       10 means: continuation of character.

Concatenate the actual bits:


Convert back to hex (It doesn't show/matter in this example, but if the number of bits doesn't divide by 4 evenly, you have to make groups of 4 bits starting from the right-hand side, then pad with zeros on the left-hand side):

Hx Binary
2b 0010 1011
c8 1100 1000

Unicode Character

2bc8 is "⯈" or "black medium right-pointing triangle centred" U+2BC8. So Gedit is saving the correct character, just not displaying the spaces around it correctly.

It looks like 2bc8 was added in Unicode 7.0 in 2014: http://unicode.org/cldr/utility/character.jsp?a=2BC8

Maybe gedit doesn't fully support 7.0 yet? Or that spaces sometimes get compressed near 3-byte UTF-8 characters?

  • Thanks. This does make sense. F.Y.I. I am just using Gedit as a pure text editor. I'm just capturing initial thoughts and ideas as I write preliminary notes and draw rough ASCII tables, flows, diagrams etc. After I refine my thinking I go on to draft proper writing/diagrams in more appropriate tools. So it's just an annoyance. – TaoRich Dec 14 '17 at 14:58
  • What you say all makes sense, but the "⯈" does display correctly. It's the spaces that do not display correctly. What is even more weird is the leading space example I added a while after the trailing space issue. In very rough language, it's almost as if Gedit is not "opening or closing" the character code display correctly when bordering on a space, but a "normal typed character" resets the display to normal. – TaoRich Dec 14 '17 at 15:16
  • Good point. If you open a bug, you might title it, "Spaces sometimes get compressed near 3-byte UTF-8 characters." It's leading spaces that are the problem in my version of gedit. Well, if it weren't terminating the character correctly it would display some weird following character and that's not what I'm seeing. I've updated my answer. Thanks! – GlenPeterson Dec 14 '17 at 15:26
  • I did another quick test; replicated the same behaviour with a Unicode 2.0 character (from the unicode.org link). So it's not a version issue. I'll write up a bug report as soon as I have a chance, and put the link up here. Thanks for your input. – TaoRich Dec 18 '17 at 8:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.