MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / emit_json

Function emit_json

skills/pdf-parser/scripts/parse_pdf.py:661–670  ·  view source on GitHub ↗

Print JSON without crashing on Windows terminals with GBK encoding.

(data: Dict[str, Any])

Source from the content-addressed store, hash-verified

659
660
661def emit_json(data: Dict[str, Any]) -> None:
662 """Print JSON without crashing on Windows terminals with GBK encoding."""
663 payload = json.dumps(data, indent=2, ensure_ascii=False)
664 try:
665 if hasattr(sys.stdout, "reconfigure"):
666 sys.stdout.reconfigure(encoding="utf-8", errors="replace")
667 print(payload)
668 except UnicodeEncodeError:
669 sys.stdout.buffer.write(payload.encode("utf-8", errors="replace"))
670 sys.stdout.buffer.write(b"\n")
671
672
673if __name__ == "__main__":

Callers 1

parse_pdf.pyFile · 0.85

Calls 1

encodeMethod · 0.80

Tested by

no test coverage detected