[libcxx-commits] [libcxx] 75394f2 - [libc++] Specify `encoding='utf-8'` in `conformance` script (#189534)

via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jun 26 14:04:30 PDT 2026


Author: A. Jiang
Date: 2026-06-26T17:04:25-04:00
New Revision: 75394f270ba59567a16d131a20140d5781ad24bd

URL: https://github.com/llvm/llvm-project/commit/75394f270ba59567a16d131a20140d5781ad24bd
DIFF: https://github.com/llvm/llvm-project/commit/75394f270ba59567a16d131a20140d5781ad24bd.diff

LOG: [libc++] Specify `encoding='utf-8'` in `conformance` script (#189534)

In some environments, especially Windows with active code page other
than 65001, some characters in the CSV files cause parse errors without
explicitly specifying the UTF-8 encoding.

Explicitly using `encoding='utf-8'` in `click.File` fixes such errors.

Added: 
    

Modified: 
    libcxx/utils/conformance

Removed: 
    


################################################################################
diff  --git a/libcxx/utils/conformance b/libcxx/utils/conformance
index 9f34c4e66bd08..a331693206e5d 100755
--- a/libcxx/utils/conformance
+++ b/libcxx/utils/conformance
@@ -496,8 +496,8 @@ def github_link(issues, meeting_voted, status):
         link_github_issue(issue, meeting_voted, status)
 
 @github_cmd.command('create')
- at click.argument('csvfiles', nargs=-1, type=click.File('r'))
- at click.option('--load-github-from', type=click.File('r'), required=False,
+ at click.argument('csvfiles', nargs=-1, type=click.File('r', encoding='utf-8'))
+ at click.option('--load-github-from', type=click.File('r', encoding='utf-8'), required=False,
     help='Optionally load the Github Conformance tracking data from the given file. Useful to avoid '
          'running into API call limits when testing locally. See `conformance github download`.')
 @click.option('--labels', type=str, multiple=True,
@@ -572,7 +572,7 @@ def github_create(csvfiles, load_github_from, labels):
 
 
 @github_cmd.command('download')
- at click.option('--output', '-o', type=click.File('w'), default='-',
+ at click.option('--output', '-o', type=click.File('w', encoding='utf-8'), default='-',
     help='Save the data to the provided file. Default is stdout.')
 def github_download(output):
     """Download libc++ conformance tracking data from Github issues and save it locally."""
@@ -587,7 +587,7 @@ def csv_cmd():
 
 
 @csv_cmd.command('validate')
- at click.argument('files', nargs=-1, type=click.File('r'))
+ at click.argument('files', nargs=-1, type=click.File('r', encoding='utf-8'))
 def csv_validate(files):
     """Validate the format of the provided CSV files."""
     for file in files:
@@ -598,10 +598,10 @@ def csv_validate(files):
 
 
 @csv_cmd.command('synchronize')
- at click.argument('files', nargs=-1, type=click.File('r'))
- at click.option('--output', '-o', type=click.File('w'), default='-',
+ at click.argument('files', nargs=-1, type=click.File('r', encoding='utf-8'))
+ at click.option('--output', '-o', type=click.File('w', encoding='utf-8'), default='-',
     help='Write the generated CSV to the specified file. Defaults to stdout.')
- at click.option('--load-github-from', type=click.File('r'), required=False,
+ at click.option('--load-github-from', type=click.File('r', encoding='utf-8'), required=False,
     help='Optionally load the Github Conformance tracking data from the given file. Useful to avoid '
          'running into API call limits when testing locally. See `conformance github download`.')
 def csv_synchronize(files, output, load_github_from):
@@ -622,9 +622,9 @@ def csv_synchronize(files, output, load_github_from):
 
 @csv_cmd.command('create')
 @click.argument('issues', nargs=-1)
- at click.option('--output', '-o', type=click.File('w'), default='-',
+ at click.option('--output', '-o', type=click.File('w', encoding='utf-8'), default='-',
     help='Write the generated CSV to the specified file. Defaults to stdout.')
- at click.option('--load-github-from', type=click.File('r'), required=False,
+ at click.option('--load-github-from', type=click.File('r', encoding='utf-8'), required=False,
     help='Optionally load the Github Conformance tracking data from the given file. Useful to avoid '
          'running into API call limits when testing locally. See `conformance github download`.')
 def csv_create(issues, output, load_github_from):


        


More information about the libcxx-commits mailing list