On Tue, 2002-12-17 at 10:13, Jeffrey Stedfast wrote:
> On Tue, 2002-12-17 at 02:04, Joe Marcus Clarke wrote:
> > Hi.  I have filed Ximian bug 34911 stating that FreeBSD users cannot
> > copy and paste text from the Mozilla/Galeon main window into Evolution. 
> > Linux users do not seem to be affected.  I did some digging, and I think
> > I'm close to solving this problem.  I just need a little help.
> > 
> > If I edit gtkhtml-1.1.7/src/gtkhtml.c, and remove the text/html format
> > from the formats array, this problem goes away.  Therefore, the cause
> > seems to be in the new text/html pasting code (i.e. the code that didn't
> > exist in gtkhtml 1.0.4).  Now, I played with the new html selection
> > functions, but I am unable to make things work.  I see that conversion
> > is being done between ucs2 and utf-8 character sets.  I'm curious as
> > ucs2, or UCS2 for that matter, is not a registered character set with
> > libiconv-1.8, nor is it statically mapped in gal's e-iconv.c.  How does
> > Linux handle this?  If I add a mapping from ucs2 to UCS-2 in e-iconv.c,
> > the problem is not solved.  And I'm not sure why gtkhtml assumes
> > Mozilla's character set is UCS2.  I personally use ISO-8859-1 (though no
> > matter which charset I choose in Mozilla, the pasting problem remains).
> 
> Mozilla's export charset is always UCS2 (aka Unicode16 aka
> iso-10646-1?). And it's internal charset is likely also unicode, despite
> what charset preferences you have chosen (although their internal
> charset *might* be utf-8, just like evolution's).
> 
> Anyways, my iconv seems to be able to handle the following:
> 
> UCS-2, UCS-2LE, UCS-2BE, UCS2, 
> UTF-16LE, UTF-16BE, UTF16, UTF16LE, UTF16BE
> 

Okay.  If I change the charset from ucs2 to ucs-2le in gtkhtml.c, the
pasting works.  The attached patch fixes it for me on i386 FreeBSD.  I
am able to copy and paste from Galeon, gaim, gnome-terminal, and from
the gtkhtml editor itself.  The leading '?' problem with pasted HTML
text seems to be gone, too.  I don't know if this patch will dtrt on
bigendian machines, though.

Joe

-- 
Joe Marcus Clarke
FreeBSD GNOME Team      ::      [EMAIL PROTECTED]
http://www.FreeBSD.org/gnome


--- src/gtkhtml.c.orig	Tue Nov  5 15:56:58 2002
+++ src/gtkhtml.c	Tue Dec 17 12:29:33 2002
@@ -1653,9 +1653,9 @@
 	be = swap ? be : !be;	
 
 	if (be)
-		return "ucs2-be";
+		return "ucs-2be";
 	else 
-		return "ucs2-le";
+		return "ucs-2le";
 	
 }
 
@@ -1733,7 +1733,7 @@
 			html_object_save (selection_object, state);
 			
 			d_s (g_warning ("text/html buffer = %s", buffer->str);)
-			selection_string = e_utf8_to_charset_string_sized ("ucs2", buffer->str, buffer->len);
+			selection_string = e_utf8_to_charset_string_sized ("ucs-2", buffer->str, buffer->len);
 			
 			if (selection_string)
 				gtk_selection_data_set (selection_data,
@@ -1897,11 +1897,11 @@
 					len  -= 2;
 					break;
 				default:
-					tocode = "ucs2";
+					tocode = ucs2_order(1);
 					break;
 				}
 				
-				utf8 = e_utf8_from_charset_string_sized ("ucs2",
+				utf8 = e_utf8_from_charset_string_sized (tocode,
 									 data,
 									 len);
 

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to