<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>87548</bug_id>
          
          <creation_ts>2012-05-25 16:34:36 -0700</creation_ts>
          <short_desc>check-webkit-style cannot running in Chinese windows.</short_desc>
          <delta_ts>2013-01-16 14:22:53 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Tools / Tests</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter name="huangxueqing">huangxueqing</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>abarth</cc>
    
    <cc>alancutter</cc>
    
    <cc>dpranke</cc>
    
    <cc>eric</cc>
    
    <cc>levin</cc>
    
    <cc>ojan</cc>
    
    <cc>tony</cc>
    
    <cc>vestbo</cc>
    
    <cc>webkit.review.bot</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>634428</commentid>
    <comment_count>0</comment_count>
    <who name="huangxueqing">huangxueqing</who>
    <bug_when>2012-05-25 16:34:36 -0700</bug_when>
    <thetext>The traceback as:
$ ./check-webkit-style --help
Traceback (most recent call last):
  File &quot;./check-webkit-style&quot;, line 48, in &lt;module&gt; sys.exit(CheckWebKitStyle().main())
  File &quot;/cygdrive/e/webkit/Tools/Scripts/webkitpy/style/main.py&quot;, line 126, in main host = Host()
  File &quot;/cygdrive/e/webkit/Tools/Scripts/webkitpy/common/host.py&quot;, line 49, in __init__    SystemHost.__init__(self)
  File &quot;/cygdrive/e/webkit/Tools/Scripts/webkitpy/common/system/systemhost.py&quot;, line 40, in __init__  self.user = user.User()
  File &quot;/cygdrive/e/webkit/Tools/Scripts/webkitpy/common/system/user.py&quot;, line 61, in __init__  self._platforminfo = platforminfo or PlatformInfo(sys, platform, Executive())
  File &quot;/cygdrive/e/webkit/Tools/Scripts/webkitpy/common/system/platforminfo.py&quot;, line 56, in __init__  self.os_version = self._determine_win_version(self._win_version_tuple(sys_module))
  File &quot;/cygdrive/e/webkit/Tools/Scripts/webkitpy/common/system/platforminfo.py&quot;, line 132, in _win_version_tuple  return self._win_version_tuple_from_cmd()
  File &quot;/cygdrive/e/webkit/Tools/Scripts/webkitpy/common/system/platforminfo.py&quot;, line 136, in _win_version_tuple_from_cmd   ver_output = self._executive.run_command([&apos;cmd&apos;, &apos;/c&apos;, &apos;ver&apos;])
  File &quot;/cygdrive/e/webkit/Tools/Scripts/webkitpy/common/system/executive.py&quot;, line 402, in run_command  output = output.decode(self._child_process_encoding())
  File &quot;/usr/lib/python2.6/encodings/utf_8.py&quot;, line 16, in decode  return codecs.utf_8_decode(input, errors, True) UnicodeDecodeError: &apos;utf8&apos; codec can&apos;t decode byte 0xb0 in position 21: unexpected code byte</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>805956</commentid>
    <comment_count>1</comment_count>
      <attachid>182481</attachid>
    <who name="huangxueqing">huangxueqing</who>
    <bug_when>2013-01-13 02:15:57 -0800</bug_when>
    <thetext>Created attachment 182481
patch

The version info retrieved in Chinese Windows was &quot;Microsoft Windows [版本 6.1.7601]&quot;, &quot;版本&quot;(&apos;version&apos; in English) was encoded as &quot;0xB0 0xE6 0xB1 0xBE&quot; and &apos;0xB0&apos; was not a valid utf-8 character, thus check-webkit-style running failed.
Actually, we execute &quot;cmd /c ver&quot; then use regular expression to match version infomation, it&apos;s unnecessary to decode the output string of execution.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>806013</commentid>
    <comment_count>2</comment_count>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2013-01-13 15:28:55 -0800</bug_when>
    <thetext>I thought that Executive was smart enough to use the local code page on windows?  

This line:

  File &quot;/cygdrive/e/webkit/Tools/Scripts/webkitpy/common/system/executive.py&quot;, line 402, in run_command  output = output.decode(self._child_process_encoding())


Clearly its the wrong encoding in your case:
http://trac.webkit.org/browser/trunk/Tools/Scripts/webkitpy/common/system/executive.py#L444

444	    def _child_process_encoding(self):
445	        # Win32 Python 2.x uses CreateProcessA rather than CreateProcessW
446	        # to launch subprocesses, so we have to encode arguments using the
447	        # current code page.
448	        if sys.platform == &apos;win32&apos; and sys.version &lt; &apos;3&apos;:
449	            return &apos;mbcs&apos;
450	        # All other platforms use UTF-8.
451	        # FIXME: Using UTF-8 on Cygwin will confuse Windows-native commands
452	        # which will expect arguments to be encoded using the current code
453	        # page.
454	        return &apos;utf-8&apos;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>806014</commentid>
    <comment_count>3</comment_count>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2013-01-13 15:30:24 -0800</bug_when>
    <thetext>It looks like this article has some relevant help:
http://stackoverflow.com/questions/1259084/what-encoding-code-page-is-cmd-exe-using</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>806042</commentid>
    <comment_count>4</comment_count>
    <who name="huangxueqing">huangxueqing</who>
    <bug_when>2013-01-13 18:24:55 -0800</bug_when>
    <thetext>(In reply to comment #2)
&gt; I thought that Executive was smart enough to use the local code page on windows?  
I execute WebKit scripts in cygwin, sys.platform == &apos;cygwin&apos; and python intergraded in cygwin did not include &apos;mbcs&apos; decoder, thus it&apos;s always use &apos;utf-8&apos; to decode output string. Actually GBK encoding used in my system but we could not dectect it.

&gt; This line:
&gt;   File &quot;/cygdrive/e/webkit/Tools/Scripts/webkitpy/common/system/executive.py&quot;, line 402, in run_command  output = output.decode(self._child_process_encoding())
&gt; Clearly its the wrong encoding in your case:
&gt; http://trac.webkit.org/browser/trunk/Tools/Scripts/webkitpy/common/system/executive.py#L444
&gt; 444        def _child_process_encoding(self):
&gt; 445            # Win32 Python 2.x uses CreateProcessA rather than CreateProcessW
&gt; 446            # to launch subprocesses, so we have to encode arguments using the
&gt; 447            # current code page.
&gt; 448            if sys.platform == &apos;win32&apos; and sys.version &lt; &apos;3&apos;:
&gt; 449                return &apos;mbcs&apos;
&gt; 450            # All other platforms use UTF-8.
&gt; 451            # FIXME: Using UTF-8 on Cygwin will confuse Windows-native commands
&gt; 452            # which will expect arguments to be encoded using the current code
&gt; 453            # page.
&gt; 454            return &apos;utf-8&apos;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>806043</commentid>
    <comment_count>5</comment_count>
    <who name="huangxueqing">huangxueqing</who>
    <bug_when>2013-01-13 18:27:44 -0800</bug_when>
    <thetext>(In reply to comment #3)
&gt; It looks like this article has some relevant help:
&gt; http://stackoverflow.com/questions/1259084/what-encoding-code-page-is-cmd-exe-using

Thanks, I will take a look at that.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>808683</commentid>
    <comment_count>6</comment_count>
      <attachid>182481</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2013-01-16 13:50:44 -0800</bug_when>
    <thetext>Comment on attachment 182481
patch

While I am not an expert, this looks fine to me.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>808703</commentid>
    <comment_count>7</comment_count>
      <attachid>182481</attachid>
    <who name="WebKit Review Bot">webkit.review.bot</who>
    <bug_when>2013-01-16 14:09:26 -0800</bug_when>
    <thetext>Comment on attachment 182481
patch

Clearing flags on attachment: 182481

Committed r139924: &lt;http://trac.webkit.org/changeset/139924&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>808704</commentid>
    <comment_count>8</comment_count>
    <who name="WebKit Review Bot">webkit.review.bot</who>
    <bug_when>2013-01-16 14:09:31 -0800</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>808716</commentid>
    <comment_count>9</comment_count>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2013-01-16 14:22:53 -0800</bug_when>
    <thetext>It is. :)  It solves this specific case, but there will be many more troubles if we&apos;re not able to decode output from cmd to the right code-page on windows.  We have code which should be doing this, but clearly isnt&apos; doing it right.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>182481</attachid>
            <date>2013-01-13 02:15:57 -0800</date>
            <delta_ts>2013-01-16 14:09:26 -0800</delta_ts>
            <desc>patch</desc>
            <filename>87548.patch</filename>
            <type>text/plain</type>
            <size>1489</size>
            <attacher name="huangxueqing">huangxueqing</attacher>
            
              <data encoding="base64">SW5kZXg6IFRvb2xzL0NoYW5nZUxvZw0KPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQ0KLS0tIFRvb2xzL0NoYW5nZUxvZwko
cmV2aXNpb24gMTM5NTYxKQ0KKysrIFRvb2xzL0NoYW5nZUxvZwkod29ya2luZyBjb3B5KQ0KQEAg
LTEsMyArMSwxMyBAQA0KKzIwMTMtMDEtMTMgIFh1ZXFpbmcgSHVhbmcgIDxodWFuZ3h1ZXFpbmdA
YmFpZHUuY29tPgorCisgICAgICAgIGNoZWNrLXdlYmtpdC1zdHlsZSBzY3JpcHQgY2Fubm90IHJ1
bm5pbmcgaW4gQ2hpbmVzZSB3aW5kb3dzLgorICAgICAgICBodHRwczovL2J1Z3Mud2Via2l0Lm9y
Zy9zaG93X2J1Zy5jZ2k/aWQ9ODc1NDgKKworICAgICAgICBSZXZpZXdlZCBieSBOT0JPRFkgKE9P
UFMhKS4KKworICAgICAgICAqIFNjcmlwdHMvd2Via2l0cHkvY29tbW9uL3N5c3RlbS9wbGF0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aF9vYmplY3QgPSByZS5zZWFyY2gocicoP1A8bWFqb3I+XGQpXC4oP1A8bWlub3I+
XGQpXC4oP1A8YnVpbGQ+XGQrKScsIHZlcl9vdXRwdXQpCiAgICAgICAgIGFzc2VydCBtYXRjaF9v
YmplY3QsICdjbWQgcmV0dXJuZWQgYW4gdW5leHBlY3RlZCB2ZXJzaW9uIHN0cmluZzogJyArIHZl
cl9vdXRwdXQKICAgICAgICAgcmV0dXJuIHR1cGxlKG1hcChpbnQsIG1hdGNoX29iamVjdC5ncm91
cHMoKSkpCg==
</data>

          </attachment>
      

    </bug>

</bugzilla>