Bug Report: TextEditor bugs when using non-english characters

Hi I’m reporting bugs and looking for possible solutions when using non-english characters in the TextEditor component. The non-english characters I’m using are Korean.

  1. Select All does not work. I’m on a mac and when using Cmd+A Korea characters do not get selected.

  2. After typing in Korean characters, when I click with a mouse on the TextEditor and type again, the character I last typed before clicking on the TextEditor gets written, followed by the new character I type.

Has anyone experienced these issues? If so, has anyone found a workaround? Thank you very much.

1 Like

I’d like to look into this, but my knowledge in this area is extremely limited, so I will need additional pointers.

Do you find that the TextEditor works well otherwise when using Korean input?

E.g. I added a “2-Set Korean” input source, and when typing into the TextEditor I’m seeing completely different glyphs than in other programs (TextEdit or Sublime Text are showing the same glyphs).

What I’m finding is that Cmd + A doesn’t work when using the 2-Set Korean input source, but it does work with some other input sources even if there are previously typed Korean characters in the TextEditor.

Thank you for your response attila. The TextEditor seems to work well with Korean input other than the issues I have mentioned.

The glyphs that you’re seeing might have to do with your current font in the Juce program not supporting Korean. I had to set my program’s font to one that supports both English and Korean for the characters to appear correctly (I used Nanum Gothic).

I also just tried with Japanese input and although Cmd+A seems to work fine, it has the same issue of previously typed characters appearing again when writing something, clicking on the text editor, then writing again.

Making the shortcuts work with any language layout seems to be a bit tricky so at this point I can only share a workaround.

On my system the keycode for the ‘a’ key when using “2-Set Korean” is 12609. So to hardcode that value, you could override bool keyPressed (const KeyPress& key) in the Component that contains your TextEditor and also call setWantsKeyboardFocus (true); in its constructor. So the function would look like

bool keyPressed (const KeyPress& key) override
{
    if (key == KeyPress (12609, ModifierKeys::commandModifier, 0))
        return textEditor.selectAll();

    return false;
}

This is of course far from ideal, but it could be a band aid until a better solution.

I’m going to take a look at the previously typed characters problem as well.