[PATCH] D56754: Add Support for Creating and Deleting Unicode Files and Directories in Lit

Jason Mittertreiner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 8 12:00:30 PST 2019


jmittert added a comment.

> What do you think of this path?

This doesn't work on Windows with Python 2 because it to_bytes doesn't convert the bytes to UTF16. It will work on Python 3 with Windows because py3 strings are already unicode aware. Running with python 2 creates the garbled `中文` directory on Windows because it tries to interpret the UTF8 as UTF16. Running with python 3 properly produces the `中文` directory.

For example, adding a quick test with

  # RUN: mkdir -p  c:/Users/jmittertreiner/Output/中文

Produces

  S:\build\Ninja-DebugAssert\llbuild-windows-amd64> dir C:\Users\jmittertreiner\Output\                                                                                     
                                                                                                                                                                            
                                                                                                                                                                            
      Directory: C:\Users\jmittertreiner\Output                                                                                                                             
                                                                                                                                                                            
                                                                                                                                                                            
  Mode                LastWriteTime         Length Name                                                                                                                     
  ----                -------------         ------ ----                                                                                                                     
  d-----         2/8/2019   9:48 AM                中文             <-- Running with Python 2                                                                                                      
  d-----         2/8/2019   9:49 AM                中文              <-- Running with Python 3

                                                         


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56754/new/

https://reviews.llvm.org/D56754





More information about the llvm-commits mailing list