File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1414- ` datacontract test ` checks the constraints and quality rules of nested properties (struct fields and array items) on Dremio servers
1515- ` datacontract test ` finds tables in Postgres schemas with upper case letters, such as ` "Reporting" `
1616- ` datacontract test ` checks the other columns of a Postgres table with a column of a type ibis cannot read, such as ` regclass `
17+ - The CLI no longer fails with ` UnicodeEncodeError ` when its output is piped on Windows
1718- ` datacontract import postgres ` and ` import sql ` no longer map bit strings of more than one bit (` bit(8) ` , ` bit varying ` ) to ` boolean `
1819
1920## [ 1.2.11] - 2026-11-17
Original file line number Diff line number Diff line change 1+ import codecs
12import logging
23import os
34import sys
@@ -387,6 +388,10 @@ def _parse_enum_csv(
387388
388389
389390def main ():
391+ # Before Python 3.15, piped output on Windows uses the ANSI code page, which cannot encode emoji.
392+ for stream in (sys .stdout , sys .stderr ):
393+ if hasattr (stream , "reconfigure" ) and codecs .lookup (stream .encoding ).name != "utf-8" :
394+ stream .reconfigure (encoding = "utf-8" )
390395 try :
391396 app ()
392397 except Exception as e :
Original file line number Diff line number Diff line change 11import json
22import os
33import re
4+ import subprocess
45import sys
6+ from pathlib import Path
57from unittest .mock import MagicMock
68
79import pytest
@@ -233,3 +235,20 @@ def test_changelog_yaml_and_json_output_hold_the_same_changes():
233235 as_json = json .loads (runner .invoke (app , args + ["json" ]).stdout )
234236 as_yaml = yaml .safe_load (runner .invoke (app , args + ["yaml" ]).stdout )
235237 assert as_yaml == as_json
238+
239+
240+ def test_test_output_is_utf8_when_console_encoding_has_no_emoji ():
241+ result = subprocess .run (
242+ [
243+ sys .executable ,
244+ "-c" ,
245+ "from datacontract.cli import main; main()" ,
246+ "test" ,
247+ "tests/fixtures/csv/data/datacontract.yaml" ,
248+ ],
249+ cwd = Path (__file__ ).parent .parent ,
250+ env = {** os .environ , "PYTHONIOENCODING" : "cp1252" },
251+ capture_output = True ,
252+ )
253+ assert result .returncode == 0 , result .stderr .decode ("utf-8" , errors = "replace" )
254+ assert any (emoji in result .stdout .decode ("utf-8" ) for emoji in "🟢🟠" )
You can’t perform that action at this time.
0 commit comments