oxen-io / session-desktop

Session Desktop - Onion routing based messenger
https://getsession.org
GNU General Public License v3.0
1.43k stars 186 forks source link

Unable to convert Japanese text input using IME on PC (Linux) #2125

Open ChanoSan opened 2 years ago

ChanoSan commented 2 years ago

Describe the bug When inputting Japanese text, I am unable to convert input from Hiragana to Kanji or Katakana. Normally, when inputting Japanese via the IME the text is highlighted, at which point using the space key allows for selection of different Kanji/Katakana/etc variations on the word and the Enter key confirms, like so:

normal_input

With Session Desktop, however, pressing space after input does not open the standard IME selection menu, but simply puts the raw Hiragana into the text field with no ability to change it, like so: Screenshot from 2021-12-25 18-34-43 Screenshot from 2021-12-25 18-35-44

Being unable to input Kanji, and only being able to input Hiragana, makes communication in Japanese somewhat difficult. The only existing workaround is to type out the sentence in gedit or another writing tool, then copy-paste it into Session's input field. This behavior has been reported by at least two other users in a Japanese language Open Group I use. I believe in both cases it was Linux, though I do not at present know which distro or any other version information for Session Desktop or their IME.

It is worth noting, that the same account logged in via Session Android has no difficult with Japanese IME. This behavior seems isolated to the Desktop version.

To Reproduce Steps to reproduce the behavior: Use a Japanese IME to input text in Session Desktop. Hit space after typing in Hiragana text, resulting in raw Hiragana input (no ability to convert to Kanji or Katakana etc).

Screenshots or Logs see above

Other information (please complete the following information):

beantaco commented 2 years ago

I also have an issue with Japanese input but with different characteristic, which I have described in another issue.

ghost commented 2 years ago

I'd like to volunteer to debug the issue but I need some supervising on Japanese input, can someone post a link to the Japanese open group channel so I can ask for help?

ghost commented 2 years ago

I think I can reproduce this one. Will take a look.

ChanoSan commented 2 years ago

I'd like to volunteer to debug the issue but I need some supervising on Japanese input, can someone post a link to the Japanese open group channel so I can ask for help?

The Open Group I was using is dedicated to an event I was running, but you want to consult with people in the group for feedback I'm sure that's fine. Link here:

http://privacyarms.com:7777/onion_comic_market?public_key=11fa20d2d5332f0f3c408858e65908612fd64345dc697e50361dea3c2811dd2f

ghost commented 2 years ago

I can observer same behavior with Ubuntu 18.04 + ibus-mozc. I don't know how to activate ibus-anthy so I am not able to test ibus-anthy yet. I'll take a look and see if I can fix the ibus-mozc one first and will ask you to validate it with ibus-anthy.

ghost commented 2 years ago

Seems like a bug in react-mentions. I'll have a look.

https://github.com/signavio/react-mentions/issues/164

beantaco commented 2 years ago

I reproduced this bug in Tails.

ghost commented 2 years ago

Can anyone here:

  1. Test with the original react-mentions implementation to confirm you can reproduce any bug? Here is the original demo: https://react-mentions.vercel.app/
  2. Test my hack on http://16.170.244.17:8080/ http://16.170.244.17:8081/ and give me some feedback?

This hack has some obvious issues, it messes up the mentioned highlight, which I'm planning to fix later.

The text input part is working for me when I test with ibus-mozc (Japanese).

It would be great if some native Japanese speakers test it with different browsers + different OSs + different IME and provide me some feedback.

If the feedback is good I'll clean up the patch and propose a proper solution.

Here is the hack for those who are curious: https://github.com/fracting/react-mentions/commit/d245d614866c2f386ce1bf3da36062b7dc1809d2

ChanoSan commented 2 years ago

It would be great if some native Japanese speakers test it with different browsers + different OSs + different IME and provide me some feedback.

I tested the with both desktop (Ubuntu Focal, Firefox) and Mobile (Android, WebView). Desktop test was using ibus-anthy. Android test was using "Mozc for Android" installed as an app and set up as a Japanese keyboard. What the name of the specific IME is (mozc? ibus-mozc? somethingelse-mozc?) I'm not sure, but there it is.

Android functioned normally in both the original react-mentions and the provided hack. This is expected, as Android Session is also unaffected by the original bug.

Firefox Desktop had buggy results in the original react-mentions test. Aside from not correctly converting to Kanji through IME selection, it would also needlessly prepend previous Hiragana entries onto new sentences typed in after the first. Upon hitting the space key, the IME selection menu would show up, however selecting Kanji or Hiragana entries from that list had no effect, and the entry remained Hiragana only.

Your hack, however, allowed normal entry. On Firefox Desktop, the IME displayed the selection menu normally, and successfully converted Hiragana entries into both Katakana and Kanji as expected.

ghost commented 2 years ago

Thanks @ChanoSan ! That's very encouraging and super helpful!

Unfortunately with my current hack, the auto-completion overlay menu is not working in IME composition mode, I still need extra time to come up with a design that supports auto-completion properly. Forgive me for asking for another test next time :-)

beantaco commented 2 years ago

Hi @fracting, how did you go fixing the Japanese IME issues? Please feel free to msg me on Session!

ghost commented 2 years ago

@beantaco I have a hack at http://16.170.244.17:8081/ feel free to test and compare with https://react-mentions.vercel.app/

My hack solves the typing problem but it doesn't support auto-completion for Japanese names, if someone called サトシ・ナカモト, with my hack we can't auto-complete a name using @サ. Proper support of that would be quite a big change to the react-mention code.

I remember I sent you http://16.170.244.17:8081/ but you had a problem testing it because of SSL warnings?

beantaco commented 2 years ago

Hi! I'll see if I can access the link again some time. PS: Sorry I'm not a big GitHub user so didn't notice your comment til now :-p

beantaco commented 2 years ago

@beantaco I have a hack at http://16.170.244.17:8081/

@fracting This appears to work fine on Tails (mozc). I didn't compare with https://react-mentions.vercel.app/ but I hope this helps.

stevenshea commented 1 year ago

@beantaco I have a hack at http://16.170.244.17:8081/ feel free to test and compare with https://react-mentions.vercel.app/

My hack solves the typing problem but it doesn't support auto-completion for Japanese names, if someone called サトシ・ナカモト, with my hack we can't auto-complete a name using @サ. Proper support of that would be quite a big change to the react-mention code.

I remember I sent you http://16.170.244.17:8081/ but you had a problem testing it because of SSL warnings?

@fracting I test this with Rime (A Chinese IME) on Windows 10 too and It also works fine. The issue of message textbox made many Asian language IME tools like crap. I'm looking forward to seeing it's gone.

reasonset commented 8 months ago

@fracting I was directed from a ticket on Zendesk. I has same problem with fcitx5/mozc. I can't try this because I can't connect to 16.170.244.17. Are you planning to incorporate this hack?

elvis-hrvat commented 4 months ago

This Issue is a duplicate of #1497. It should be closed to avoid dispersing the discussion.

elvis-hrvat commented 4 months ago

This is not just a Japanese language problem. It applies to Chinese, Korean, and Vietnamese as well, so why not rename the Issue from Japanese to the CJKV language?

elvis-hrvat commented 4 months ago

Oxen has neglected this extremely serious issue for more than two years. Not only have they not fixed it, they haven't even commented on it...Session sucks.

KeeJef commented 4 months ago

I had a look at this and reached out to some contacts with a bit more info on the problem.

The fundamental issue comes from how different operating systems design their IME system APIs, which cannot be fully abstracted by browsers, leading to inconsistent behavior across various platforms. This issue is compounded by how different IME applications interact with these APIs using various patterns. Libraries like react-mention, which handle raw IME events directly, need to make some assumptions about how other IME applications work. As a result, a vast number of combinations must be tested, and there are always edge cases here and there, some of those patterns are fundamentally incompatible with each other.

In the case of react-mention, there are three type of observable behaviors:

  1. Auto-completion works perfectly.
  2. Auto-completion is missing, but the user can still type properly.
  3. Auto-completion fails, and the user cannot input correctly.

If we want to continue to use react-mention we can patch the third scenario, but it seems this causes regressions which increase the frequency of the first and second behaviors, not sure if there is a way around this. It would be great if this could be addressed upstream however react-mentions isn't the most active package.

Perhaps the better long term solution is for Session to move away from react-mentions entirely and adopt the approach used by Signal Desktop, which supports auto-completion through a different method, using isolated divs for auto-completing text without messing with the entire input area.

mopeneko commented 3 months ago

Are there any solutions? 😢

pottsandpans commented 2 months ago

This is being tracked on Jira: https://optf.atlassian.net/browse/SES-1699