Skip to content

Commit 88e6348

Browse files
committed
Fix encoding
1 parent 574e84a commit 88e6348

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

clang-tools-extra/test/clang-tidy/checkers/modernize/use-std-print.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ void printf_deceptive_newline() {
5555
}
5656

5757
void printf_utf8_text() {
58-
// Non-ASCII UTF-8 in format string should not crash.
59-
printf("你好世界\n");
58+
// Hex encodes U+4F60 U+597D U+4E16 U+754C (Hello world) in UTF-8
59+
printf("\xE4\xBD\xA0\xE5\xA5\xBD\xE4\xB8\x96\xE7\x95\x8C\n");
6060
// CHECK-MESSAGES: [[@LINE-1]]:3: warning: use 'std::println' instead of 'printf' [modernize-use-std-print]
61-
// CHECK-FIXES: std::println("你好世界");
61+
// CHECK-FIXES: std::println("{{.+}}");
6262
}
6363

6464
void printf_crlf_newline() {
@@ -311,10 +311,10 @@ void fprintf_simple() {
311311
}
312312

313313
void fprintf_utf8_text() {
314-
// Non-ASCII UTF-8 in format string should not crash.
315-
fprintf(stderr, "你好世界\n");
314+
// Hex encodes U+4F60 U+597D U+4E16 U+754C (Hello world) in UTF-8
315+
fprintf(stderr, "\xE4\xBD\xA0\xE5\xA5\xBD\xE4\xB8\x96\xE7\x95\x8C\n");
316316
// CHECK-MESSAGES: [[@LINE-1]]:3: warning: use 'std::println' instead of 'fprintf' [modernize-use-std-print]
317-
// CHECK-FIXES: std::println(stderr, "你好世界");
317+
// CHECK-FIXES: std::println(stderr, "{{.+}}");
318318
}
319319

320320
void std_printf_simple() {

0 commit comments

Comments
 (0)