Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Clipboard doesn't work for Chinese characters #121

Closed
babaric-dev opened this issue Jan 1, 2023 · 44 comments
Closed

[Bug]: Clipboard doesn't work for Chinese characters #121

babaric-dev opened this issue Jan 1, 2023 · 44 comments

Comments

@babaric-dev
Copy link
Contributor

Clipboard can paste english chars and numbers, but not Chinese characters, Japanese too. I think this occurs for other languages/symbols too.

@babaric-dev
Copy link
Contributor Author

babaric-dev commented Jan 1, 2023

DISCOVERY: "∆" (or any symbol) on Gboard sends to remote properly but not when it is being pasted into AVNC when copied from another text editor.

These symbols work too: √π÷׶£¢€¥^

I think that all symbols work when being typed. So possibly Chinese chars too (can't test because I can't open Chinese keyboard in AVNC)

@gujjwal00
Copy link
Owner

Yeah, this is expected. Core RFB protocol only supports Latin-1 character set for clipboard sharing. See https://www.rfc-editor.org/rfc/rfc6143#page-19 for the spec.

There is an extension to support other encodings, but I haven't looked at how well it is implemented.

@Neustradamus
Copy link

To follow.

@babaric-dev
Copy link
Contributor Author

Any updates?

@gujjwal00
Copy link
Owner

This is not a bug in AVNC. Unicode support needs to implemented in LibVNCClient first. Then AVNC will be able to utilize it.

@babaric-dev
Copy link
Contributor Author

babaric-dev commented Jan 16, 2023

LibVNC/libvncserver#399 has this already been implemented?

@gety9
Copy link

gety9 commented Jan 20, 2023

@gujjwal00 hi, first of all thank you for great vnc viewer! fast/UX friendly, keep up the good work!

i have same issue using avnc viewer app + tigervnc server (v1.10.1-31) setup.

Send legacy events is enabled.

Do i understand it right that it will work with version 1.10.10 and up? (LibVNC/libvncserver#399)

(or maybe it should be updated to 1.12.0 cause release says
"Fixed the clipboard Unicode handling in both the native viewer and the servers"
https://github.com/TigerVNC/tigervnc/releases/tag/v1.12.0)

I mean will this 'unicode bridge' on tigervnc server side be enough to make non-english copy pate work with avnc client?

@gety9
Copy link

gety9 commented Jan 20, 2023

@babaric-dev @Neustradamus any of you guys using tigervnc by the chance? were you able to fix the issue by updating to latest version?

@gujjwal00
Copy link
Owner

Hi @gety9, I am glad to know you like AVNC.

The LibVNCServer issue you are referring has added only server-side support. So any VNC server built using LibVNCServer can take advantage of it. Client-side support still needs to be implemented in LibVNCClient, before AVNC can use it.

And just like server-side, someone will have to implement it. All I can say is when I have some free time, I will look into it.

@gety9
Copy link

gety9 commented Jan 21, 2023

@gujjwal00 Gaurav, thx for quick reply

Client-side support still needs to be implemented in LibVNCClient, before AVNC can use it.

Could you please explain (to vnc newbie):

  1. how it works? I assumed avnc is separate vnc client... and is already has unicode suport (Send legacy events feature). Or is it build on top of LibVNCClient? (and thus implementation needs to be done also for LibVNCClient)

  2. if you will find time to implement will it work with other vnc servers (like tigervnc), or only with LibVNCServer?

@babaric-dev
Copy link
Contributor Author

babaric-dev commented Jan 22, 2023

@gety9 I am using Xtigervnc (1.12.0)
Same still occurs regardless of "Send Legacy Key events" setting.

@gujjwal00 gujjwal00 reopened this Jan 23, 2023
@gujjwal00
Copy link
Owner

how it works? I assumed avnc is separate vnc client... and is already has unicode suport (Send legacy events feature). Or is it build on top of LibVNCClient? (and thus implementation needs to be done also for LibVNCClient)

Yes, AVNC uses LibVNCClient to handle VNC protocol. And it seems that someone is already working to add support for Unicode clipboard.

Same still occurs regardless of "Send Legacy Key events" setting.

This setting does not affect copy/paste. It only affects 'typing' non-English characters in some situations.

@babaric-dev
Copy link
Contributor Author

So this issue will be automatically fixed if the PR there is merged?

@gety9
Copy link

gety9 commented Jan 23, 2023

@gujjwal00 thx for explanation, now all is clear.

@gety9
Copy link

gety9 commented Feb 13, 2023

@gujjwal00 Gaurav, could you please look into this issue?

I know you are doing this in your free time, and appreciate all you done - it's just that this issue is VERY uncomfortable for foreign alphabet users (and there are many of use amoun avnc users)

@babaric-dev
Copy link
Contributor Author

babaric-dev commented Feb 15, 2023

@gujjwal00 I think they added utf8 support in these 2 days (not sure). Please look into it.

@gujjwal00
Copy link
Owner

Can all of you please test this APK: app-debug.zip
It should support all characters (assuming extended clipboard is supported by your server).

I am looking for the following details:

  • Your VNC Server name
  • VNC Server version
  • Copy/paste works: Yes/No

If you use more than one servers, please test with each one.

@babaric-dev
Copy link
Contributor Author

babaric-dev commented Mar 3, 2023

AVNC shows disconnected message when entering the VNC viewer if server does not support all characters.

Only occurs when text contains unicode characters:

測試

but not when using ASCII characters:

test

Host: Termux (Android 7 variant)
Server: TigerVNC
Version: 1.10.0

@babaric-dev
Copy link
Contributor Author

However, all works well with a server that does support all characters.

Host: Ubuntu 22.04 LTS
Server: TigerVNC
Version: 1.12.0

@babaric-dev
Copy link
Contributor Author

We just need to fix servers that do not support Unicode. Then it's perfect.

@gujjwal00
Copy link
Owner

AVNC shows disconnected message when entering the VNC viewer if server does not support all characters.

Please attach the logs from AVNC and TigerVNC (if possible).

@gujjwal00
Copy link
Owner

Nevermind, I figured out the issue with 1.10.0.

It is the same bug I found in UltraVNC yesterday (ultravnc/UltraVNC#74). TigerVNC v1.11+ should work correctly.

@babaric-dev
Copy link
Contributor Author

Any handle for this bug so the viewer doesn't disconnected straight away?

@gujjwal00
Copy link
Owner

I am not sure how to avoid it, other than disabling clipboard sharing.
If LibVNCClient tries to fix this by emulating buggy behavior, there is no guarantee that it won't break other servers.

@babaric-dev
Copy link
Contributor Author

Then add a toggle (default disabled) for extending clipboard support? Not sure is this possible though.

@gujjwal00
Copy link
Owner

It is possible, but I am trying to avoid that.
Can you double check that crash only happens with Chinese text, and not with English text?

@babaric-dev
Copy link
Contributor Author

Yes.

AVNC shows disconnected message when entering the VNC viewer if server does not support all characters.

Only occurs when text contains unicode characters:

測試

but not when using ASCII characters:

test

Host: Termux (Android 7 variant) Server: TigerVNC Version: 1.10.0

Please try out the example. It only crashed when Chinese text.

@gujjwal00
Copy link
Owner

I tried, but v1.10 crashes with both samples for me.

@babaric-dev
Copy link
Contributor Author

babaric-dev commented Mar 4, 2023

I tried, but v1.10 crashes with both samples for me.

Oh yeah, right. Sorry for my mistake. Brain must have stopped working at that moment.
Both Chinese and English do not work.

@RudiDeVos
Copy link

Thanks for the Z_STREAM patch

@gety9
Copy link

gety9 commented Mar 5, 2023

@gujjwal00

host termux
server tigervnc
ver 1.10.1-34 (latest)

getting insta disconnect on the app-debug.zip (regular app connects fine). Obviously i can't test copy paste, input is set to regular english.

Do i understand it right that i need to ask termux guys to update tigervnc to 1.11?

@babaric-dev
Copy link
Contributor Author

babaric-dev commented Mar 5, 2023

Do i understand it right that i need to ask termux guys to update tigervnc to 1.11?

Nope. Impossible.
Reference: termux/termux-packages#12210

@gety9
Copy link

gety9 commented Mar 5, 2023

@babaric-dev so what's the solution?

why it works for xtkoba on 1.10.1-31
termux/termux-packages#12210 (comment)

and not for us with 1.10.1-34?

He is saying it should work
termux/termux-packages#14647 (comment)

@gujjwal00
Copy link
Owner

why it works for xtkoba

Because their VNC client also has a bug 😀. There are two bugs at play here: First, some servers don't handle zlib streams (used to compress clipboard data) correctly, leading to server crash. Second, some clients don't create zlib streams correctly, thus avoiding the server bug.

This is probably why the server bug went unnoticed for so long, and now it has turned into a "feature" 😂.

@babaric-dev
Copy link
Contributor Author

So any proposed solution?

@gety9
Copy link

gety9 commented Mar 8, 2023

@babaric-dev

i think xtkoba implemented the patch in 1.10.1-35
termux/termux-packages#15473

gujjwal00 added a commit that referenced this issue Mar 10, 2023
This enable UTF-8 encoded clipboard sharing.

Re: #121
gujjwal00 added a commit that referenced this issue Mar 10, 2023
This enables UTF-8 encoded clipboard sharing.

Re: #121
@babaric-dev
Copy link
Contributor Author

Is extended clipboard available now? Looking forward to next release.

@gujjwal00
Copy link
Owner

Is extended clipboard available now? Looking forward to next release.

Yes, and v2.2.0 is now available.

I have have included a patch to emulate behavior of other clients for now. All servers I tested had this bug, because base code was same. So v2.2.0 should work with all servers which support extended clipboard. If you encounter an issue, please let me know.

@Neustradamus
Copy link

UltraVNC 1.4.0.9 has a fix, can you look it and confirm that it is solved with 2.2.0?

@babaric-dev
Copy link
Contributor Author

@gujjwal00 Is AVNC 2.2.0 available on Fdroid and Google Play Store? Both are still 2.1.2.

@gujjwal00
Copy link
Owner

F-Droid takes couple of days to build it, while Play Store is rolling out incrementally.

@gety9
Copy link

gety9 commented May 24, 2023

@babaric-dev

did you find a way to make it work on termux?

@babaric-dev
Copy link
Contributor Author

It's working now, at least on Termux proot-distro

@gety9
Copy link

gety9 commented May 28, 2023

works on my end too
(server: termux's tigervnc 1.10.1-39
client app: AVNC 2.2.2)

@gujjwal00 Gaurav, thank you for the fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants