-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Required prerequisites
- Make sure you've read the documentation. Your issue may be addressed there.
- Search the issue tracker and Discussions to verify that this hasn't already been reported. +1 or comment there if it has.
- Consider asking first in the Gitter chat room or in a Discussion.
What version (or hash if on master) of pybind11 are you using?
pybind11-3.0.1
Problem description
Replace non-ASCII characters in comments with ASCII equivalents to fix C4819 warnings on Windows.
This PR addresses recurring C4819 compiler warnings on Windows when using pybind11 with non-Unicode code pages (e.g., CP936):
warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss.
The warnings are triggered by a few non-ASCII Unicode characters (e.g., en-dash –, em-dash —, smart quotes, or mathematical symbols) present in source comments. While harmless, these warnings clutter build logs—especially in large projects or CI pipelines—and may confuse new users.
This change:
Replaces all non-ASCII characters in comments only with standard ASCII equivalents (e.g., – → -, “/” → ", ‘/’ → ').
Does not modify any code, identifiers, string literals, or functionality.
Maintains comment clarity and readability.
Improves compatibility with legacy Windows toolchains without requiring file encoding changes.
Files affected:
include/pybind11/cast.h
include/pybind11/detail/struct_smart_holder.h
(and any other files found to contain non-ASCII comment characters)
This is a purely cosmetic and compatibility-focused change with zero runtime impact.
Fixes: (optional: reference an issue if one exists, e.g., #XXXX)
Reproducible example code
Is this a regression? Put the last known working version here if it is.
Not a regression