@@ -209,7 +209,8 @@ def _main() -> None:
)
args = argparser.parse_args()
if args.mqtt_password_path:
- mqtt_password = args.mqtt_password_path.read_text()
+ # .read_text() replaces \r\n with \n
+ mqtt_password = args.mqtt_password_path.read_bytes().decode()
if mqtt_password.endswith("\r\n"):
mqtt_password = mqtt_password[:-2]
elif mqtt_password.endswith("\n"):
@@ -79,6 +79,7 @@ def test__main(
("secret\n\n", "secret\n"),
("secret\r\n", "secret"),
("secret\n\r\n", "secret\n"),
+ ("你好\n", "你好"),
],
def test__main_password_file(tmpdir, password_file_content, expected_password):