Peter,

VNC 4.1.1 has no such function as removeNonAsciiChars(), replacing it
instead with removeNonISOLatin1Chars(), specifically in order to support
accented characters.  The problem you are seeing is a known bug in VNC
4.1.1, caused by comparing a signed char with ISO-8859-1 character values,
which are unsigned.  Replacing the removeNonISOLatin1Chars() function with
the following will fix the problem:

void
removeNonISOLatin1Chars(char* text) {
  int len = strlen(text);
  int i=0, j=0;
  for (; i<len; i++) {
    unsigned char c=text[i];
    if (((c >= 1) && (c <= 127)) ||
        ((c >= 160) && (c <= 255)))
      text[j++] = text[i];
  }
  text[j] = 0;
}

removeNonISOLatin1Chars() MUST be called in order to ensure that a
viewer/server is does not attempt to send clipboard contents that have
non-ISO-Latin-1 characters, as required by the RFB protocol.

Regards,

Wez @ RealVNC Ltd.
 

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Peter Estrand
> Sent: 27 June 2005 12:24
> To: [email protected]
> Subject: Clipboard fails with non-ascii chars
> 
> The clipboard implementation in the Windows vncviewer does not handle 
> non-ascii characters. This is true for the 4.0 and 4.1.1 
> version. This is 
> because non-ascii chars are explicitly removed. Why? The patch below 
> restores the vncviewer3 behaviour and solves our problem (cut 
> and paste 
> with Swedish chars).
> 
> diff -u -r1.1.1.1 Clipboard.cxx
> --- rfb_win32/Clipboard.cxx     8 Oct 2004 09:44:28 -0000     
>   1.1.1.1
> +++ rfb_win32/Clipboard.cxx     27 Jun 2005 11:19:32 -0000
> @@ -126,7 +126,7 @@
>                 } else {
>                   CharArray unix_text;
>                   unix_text.buf = dos2unix(clipdata);
> -                removeNonAsciiChars(unix_text.buf);
> +                // removeNonAsciiChars(unix_text.buf);
>                   notifier->notifyClipboardChanged(unix_text.buf, 
> strlen(unix_text.buf));
>                 }
>               } else {
> @@ -162,7 +162,7 @@
>       // - Pre-process the supplied clipboard text into DOS format
>       CharArray dos_text;
>       dos_text.buf = unix2dos(text);
> -    removeNonAsciiChars(dos_text.buf);
> +    // removeNonAsciiChars(dos_text.buf);
>       int dos_text_len = strlen(dos_text.buf);
> 
>       // - Allocate global memory for the data
> 
> 
> -- 
> Peter Estrand         Chief Developer
> Cendio                        www.thinlinc.com
> Teknikringen 3                www.cendio.se
> 583 30 Linkvping        Phone: +46-13-21 46 00
> _______________________________________________
> VNC-List mailing list
> [email protected]
> To remove yourself from the list visit:
> http://www.realvnc.com/mailman/listinfo/vnc-list
_______________________________________________
VNC-List mailing list
[email protected]
To remove yourself from the list visit:
http://www.realvnc.com/mailman/listinfo/vnc-list

Reply via email to