Skip to content

[libc++] Specify encoding='utf-8' in conformance script#189534

Merged
ldionne merged 1 commit into
llvm:mainfrom
frederick-vs-ja:libcxx-conformance-file-u8
Jun 26, 2026
Merged

[libc++] Specify encoding='utf-8' in conformance script#189534
ldionne merged 1 commit into
llvm:mainfrom
frederick-vs-ja:libcxx-conformance-file-u8

Conversation

@frederick-vs-ja

Copy link
Copy Markdown
Contributor

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.

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.
@frederick-vs-ja
frederick-vs-ja requested a review from ldionne March 31, 2026 05:42
@frederick-vs-ja
frederick-vs-ja marked this pull request as ready for review March 31, 2026 05:42
@frederick-vs-ja
frederick-vs-ja requested a review from a team as a code owner March 31, 2026 05:42
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Mar 31, 2026
@llvmbot

llvmbot commented Mar 31, 2026

Copy link
Copy Markdown
Member

@llvm/pr-subscribers-libcxx

Author: A. Jiang (frederick-vs-ja)

Changes

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.


Full diff: https://github.com/llvm/llvm-project/pull/189534.diff

1 Files Affected:

  • (modified) libcxx/utils/conformance (+9-9)
diff --git a/libcxx/utils/conformance b/libcxx/utils/conformance
index 20750204fce50..ae8093c0dd7ce 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')
-@click.argument('csvfiles', nargs=-1, type=click.File('r'))
-@click.option('--load-github-from', type=click.File('r'), required=False,
+@click.argument('csvfiles', nargs=-1, type=click.File('r', encoding='utf-8'))
+@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,
@@ -565,7 +565,7 @@ def github_create(csvfiles, load_github_from, labels):
 
 
 @github_cmd.command('download')
-@click.option('--output', '-o', type=click.File('w'), default='-',
+@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."""
@@ -580,7 +580,7 @@ def csv_cmd():
 
 
 @csv_cmd.command('validate')
-@click.argument('files', nargs=-1, type=click.File('r'))
+@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:
@@ -591,10 +591,10 @@ def csv_validate(files):
 
 
 @csv_cmd.command('synchronize')
-@click.argument('files', nargs=-1, type=click.File('r'))
-@click.option('--output', '-o', type=click.File('w'), default='-',
+@click.argument('files', nargs=-1, type=click.File('r', encoding='utf-8'))
+@click.option('--output', '-o', type=click.File('w', encoding='utf-8'), default='-',
     help='Write the generated CSV to the specified file. Defaults to stdout.')
-@click.option('--load-github-from', type=click.File('r'), required=False,
+@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):
@@ -615,9 +615,9 @@ def csv_synchronize(files, output, load_github_from):
 
 @csv_cmd.command('create')
 @click.argument('issues', nargs=-1)
-@click.option('--output', '-o', type=click.File('w'), default='-',
+@click.option('--output', '-o', type=click.File('w', encoding='utf-8'), default='-',
     help='Write the generated CSV to the specified file. Defaults to stdout.')
-@click.option('--load-github-from', type=click.File('r'), required=False,
+@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):

@frederick-vs-ja

Copy link
Copy Markdown
Contributor Author

@ldionne I guess I also need to request some permissions. When I ran the script (modified with explicit UTF-8 encoding), I still encountered the following error:

GraphQL: frederick-vs-ja does not have the correct permissions to execute `AddProjectV2ItemById` (add_000)

@ldionne

ldionne commented Jun 26, 2026

Copy link
Copy Markdown
Member

@ldionne I guess I also need to request some permissions. When I ran the script (modified with explicit UTF-8 encoding), I still encountered the following error:

GraphQL: frederick-vs-ja does not have the correct permissions to execute `AddProjectV2ItemById` (add_000)

I think you should have access now, I gave reviewers-libcxx write access.

@ldionne
ldionne merged commit 75394f2 into llvm:main Jun 26, 2026
83 checks passed
LouisLu060211 pushed a commit to LouisLu060211/llvm-project that referenced this pull request Jun 30, 2026
)

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.
maarcosrmz pushed a commit to maarcosrmz/llvm-project that referenced this pull request Jul 1, 2026
)

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants