Bug 21953

Summary: Hyphenate UTF-8 and UTF-16BE
Product: poppler Reporter: Jeremy C. Reed <reed>
Component: glib frontendAssignee: poppler-bugs <poppler-bugs>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: NetBSD   
Whiteboard:
i915 platform: i915 features:

Description Jeremy C. Reed 2009-05-26 18:46:36 UTC
The following is from pkgsrc patches to fix a problem with interactive forms:
(This is not my writeup or patch.)

-where iconv() is called to fill in a text field, use "UTF-8" and
 "UTF-16BE" as encoding names rather than the less portable
 "UTF8" and "UTF16BE" -- this makes it work on NetBSD

Not that wikipedia is always the best source, but 
http://en.wikipedia.org/wiki/UTF-8 says "... descriptions that omit the hyphen ... such as "utf8" ... [is] incorrect and should be avoided."

$NetBSD: patch-am,v 1.1 2009/04/06 09:29:27 drochner Exp $

--- glib/poppler-form-field.cc.orig	2008-10-09 22:30:34.000000000 +0200
+++ glib/poppler-form-field.cc
@@ -279,7 +279,7 @@ poppler_form_field_text_set_text (Popple
 	
   g_return_if_fail (field->widget->getType () == formText);
 
-  tmp = text ? g_convert (text, -1, "UTF16BE", "UTF8", NULL, &length, NULL) : NULL;
+  tmp = text ? g_convert (text, -1, "UTF-16BE", "UTF-8", NULL, &length, NULL) : NULL;
   goo_tmp = new GooString (tmp, length);
   g_free (tmp);
   static_cast<FormWidgetText*>(field->widget)->setContent (goo_tmp);
@@ -552,7 +552,7 @@ poppler_form_field_choice_set_text (Popp
 
   g_return_if_fail (field->widget->getType () == formChoice);
 
-  tmp = text ? g_convert (text, -1, "UTF16BE", "UTF8", NULL, &length, NULL) : NULL;
+  tmp = text ? g_convert (text, -1, "UTF-16BE", "UTF-8", NULL, &length, NULL) : NULL;
   goo_tmp = new GooString (tmp, length);
   g_free (tmp);
   static_cast<FormWidgetChoice*>(field->widget)->setEditChoice (goo_tmp);
Comment 1 Albert Astals Cid 2009-05-27 10:09:50 UTC
Before accepting the patch we need:
 * Full name of who created the patch
 * E-mail address of who created the patch
 * Consent to license his patch under GPLv2 or later

More than welcome:
 * Test case this fixes
Comment 2 Albert Astals Cid 2009-06-02 14:12:41 UTC
i got a personal mail with required info, the pdf is private so i won't post it
here.
Comment 3 Carlos Garcia Campos 2009-06-04 11:20:57 UTC
Applied to git master. Thanks for the patch!. 

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.