[pecl-file_formats-yaml] fix-unicode-emit: fixes #84

From: Date: Sun, 05 Apr 2026 14:24:05 +0000
Subject: [pecl-file_formats-yaml] fix-unicode-emit: fixes #84
Groups: php.pecl.cvs 
Request: Send a blank email to pecl-cvs+get-28474@lists.php.net to get a copy of this message
Author: Rasmus Lerdorf (rlerdorf) Date: 2026-04-05T10:23:49-04:00 Commit: https://github.com/php/pecl-file_formats-yaml/commit/cbe7ecff8bdfd8099fba5e070c77da4270c53262 Raw diff: https://github.com/php/pecl-file_formats-yaml/commit/cbe7ecff8bdfd8099fba5e070c77da4270c53262.diff fixes #84 Changed paths: M tests/yaml_emit_001.phpt M tests/yaml_emit_002.phpt M yaml.c Diff: diff --git a/tests/yaml_emit_001.phpt b/tests/yaml_emit_001.phpt index 5c629c5..6e08bc8 100644 --- a/tests/yaml_emit_001.phpt +++ b/tests/yaml_emit_001.phpt @@ -112,8 +112,8 @@ string(58) "--- |- an embedded newline. ... " -string(267) "--- "This string was made with a here doc.\n\nIt contains embedded newlines.\n \t\tIt +string(253) "--- "This string was made with a here doc.\n\nIt contains embedded newlines.\n \t\tIt also has some embedded tabs.\n\nHere are some symbols:\n`~!@#$%^&*()_-+={}[]|\\:\";'<>,.?/\n\nThese - are extended characters: I\xF1t\xEBrn\xE2ti\xF4n\xE0liz\xE6ti\xF8n\n\n" + are extended characters: Iñtërnâtiônàlizætiøn\n\n" ... " diff --git a/tests/yaml_emit_002.phpt b/tests/yaml_emit_002.phpt index 36277a7..c46b4a2 100644 --- a/tests/yaml_emit_002.phpt +++ b/tests/yaml_emit_002.phpt @@ -67,7 +67,7 @@ var_dump(yaml_emit(array())); ?> --EXPECT-- === Array of scalars === -string(604) "--- +string(590) "--- - ~ - true - false @@ -94,7 +94,7 @@ string(604) "--- an embedded newline. - "This string was made with a here doc.\n\nIt contains embedded newlines.\n \t\tIt also has some embedded tabs.\n\nHere are some symbols:\n`~!@#$%^&*()_-+={}[]|\\:\";'<>,.?/\n\nThese - are extended characters: I\xF1t\xEBrn\xE2ti\xF4n\xE0liz\xE6ti\xF8n\n\n" + are extended characters: Iñtërnâtiônàlizætiøn\n\n" ... " === Nested === diff --git a/yaml.c b/yaml.c index 7fb0a02..160d784 100644 --- a/yaml.c +++ b/yaml.c @@ -574,7 +574,7 @@ PHP_FUNCTION(yaml_emit) yaml_emitter_set_canonical(&emitter, YAML_G(output_canonical)); yaml_emitter_set_indent(&emitter, YAML_G(output_indent)); yaml_emitter_set_width(&emitter, YAML_G(output_width)); - yaml_emitter_set_unicode(&emitter, YAML_ANY_ENCODING != encoding); + yaml_emitter_set_unicode(&emitter, 1); if (SUCCESS == php_yaml_write_impl( &emitter, data, (yaml_encoding_t) encoding, @@ -637,7 +637,7 @@ PHP_FUNCTION(yaml_emit_file) yaml_emitter_set_canonical(&emitter, YAML_G(output_canonical)); yaml_emitter_set_indent(&emitter, YAML_G(output_indent)); yaml_emitter_set_width(&emitter, YAML_G(output_width)); - yaml_emitter_set_unicode(&emitter, YAML_ANY_ENCODING != encoding); + yaml_emitter_set_unicode(&emitter, 1); RETVAL_BOOL((SUCCESS == php_yaml_write_impl( &emitter, data, YAML_ANY_ENCODING, callbacks)));

« previous php.pecl.cvs (#28474) next »