dongjoon-hyun opened a new pull request, #57056: URL: https://github.com/apache/spark/pull/57056
### What changes were proposed in this pull request? This PR adds an explicit `encoding="utf-8"` to all text-mode I/O in the PySpark runtime (non-test) code. Note that - The JVM <-> Python boundary is also unchanged: it already uses explicit UTF-8 (`StandardCharsets.UTF_8` on the Scala side, binary sockets with `UTF8Deserializer` on the Python side). - the test code and doctests are unchanged (they read and write with the same default, so they are self-consistent). ### Why are the changes needed? [PEP 686](https://peps.python.org/pep-0686/) makes UTF-8 mode the default in Python 3.15, changing the default encoding of text-mode I/O from the locale encoding to UTF-8. On non-UTF-8 locales (Windows cp1252/cp949, POSIX `C`), the same code would behave differently on Python <= 3.14 and 3.15. Explicit encoding pins the behavior across all versions and locales. ### Does this PR introduce _any_ user-facing change? No. On UTF-8 locales the behavior is identical; on non-UTF-8 locales, files written by PySpark are now consistently UTF-8, matching the Python 3.15 default. ### How was this patch tested? Pass the CIs. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Claude Fable 5 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
