Skip to content
  • Dylan Baker's avatar
    framework: fix unicode command line arguments with python 2.x · 6a9d0146
    Dylan Baker authored
    
    
    In python 3.x input is unicode by default, but in python 2.x everything
    is a byte string by default (which assumes ascii encoding), this
    includes input. Currently when running with python 3.x it's possible to
    use unicode for input, but python 2.x will choke when it tries to encode
    the bytes into unicode using the ascii codec.
    
    For example, this will work with python 3.x but no with python 2.x:
    (The character is yuki, Japanese for snow, if memory serves)
    ./piglit run quick 雪 -c
    
    This is actually pretty easy to fix, when running with python 2.x
    decode each input element into unicode using utf-8 as soon as the input
    is received. This fixes the above example to work.
    
    Signed-off-by: default avatarDylan Baker <dylanx.c.baker@intel.com>
    Tested-by: default avatarMarek Olšák <marek.olsak@amd.com>
    6a9d0146