[Portland-bugs] [Bug 13139] New: xdg-email fails with unicode strings if using gawk

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Wed Nov 7 20:17:48 PST 2007


http://bugs.freedesktop.org/show_bug.cgi?id=13139

           Summary: xdg-email fails with unicode strings if using gawk
           Product: Portland
           Version: unspecified
          Platform: x86 (IA32)
        OS/Version: Linux (All)
            Status: NEW
          Severity: normal
          Priority: medium
         Component: xdg-utils
        AssignedTo: portland-bugs at lists.freedesktop.org
        ReportedBy: ncliang at gmail.com


Hi,

The following command brings up a mail composition dialog with blank subject
instead of the subject 안 as expected on my system with gawk installed:

xdg-email aaa at aaa.com --subject "안"

However, this works fine on systems that use mawk (such as Feisty). The problem
is within the awk code embedded in the url_encode function:

-- snip --
for ( i=1; i<=length ($0); ++i ) {
    c = substr ($0, i, 1)
    if ( ord [c] > 127 ) {
-- snip --

In gawk, string manipulation functions such as length are unicode-aware and
return the number of unicode characters instead of the number of bytes. This
would usually be a good thing, but in this case the unicode character should be
broken up into bytes to be encoded properly. 

Setting LANG and LC_ALL to C right before this snippet tricks awk into thinking
the string is ascii and processes it accordingly.


-- 
Configure bugmail: http://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.


More information about the Portland-bugs mailing list