Proves that ``dc:title`` and ``dc:creator`` round-trip bytes with non-ASCII payloads covering CJK ideographs, right-to-left Arabic, and a multi-codepoint emoji.
Library verdicts: python-docx: — docxjs: —
| Feature id | docx/core-properties-unicode |
|---|---|
| Format | docx |
| Category | metadata |
| Spec | ecma-376-5-part-2 § 11.1 |
| ID / part | Predicate | XPath | python-docx | docxjs |
|---|---|---|---|---|
unicode-title-valuedocProps/core.xml | equal = 测试标题 مرحبا 👨👩👧The <dc:title> element must preserve CJK, Arabic and emoji bytes verbatim. | //dc:title | — | — |
unicode-creator-valuedocProps/core.xml | equal = 作者 كاتب 📝The <dc:creator> element must preserve CJK, Arabic and emoji bytes verbatim. | //dc:creator | — | — |
No render assertions declared.
scripts/gen_core_properties_unicode.py
#!/usr/bin/env python3
"""Generate ``fixtures/docx/core-properties-unicode.docx``.
Exercises the non-ASCII round-trip path for ``dc:title`` and ``dc:creator``.
The fixture value combines CJK ideographs, a short Arabic (right-to-left)
fragment, and a multi-codepoint ZWJ family emoji to stress-test any
intermediate normalisation the authoring library might do.
"""
from __future__ import annotations
import datetime as _dt
from pathlib import Path
from docx import Document
_REPO_ROOT = Path(__file__).resolve().parent.parent
_OUT = _REPO_ROOT / "fixtures" / "docx" / "core-properties-unicode.docx"
_PINNED_CREATED = _dt.datetime(2026, 1, 1, 0, 0, 0, tzinfo=_dt.timezone.utc)
_PINNED_MODIFIED = _dt.datetime(2026, 1, 2, 0, 0, 0, tzinfo=_dt.timezone.utc)
def main() -> int:
doc = Document()
cp = doc.core_properties
cp.created = _PINNED_CREATED
cp.modified = _PINNED_MODIFIED
cp.title = "测试标题 مرحبا \U0001f468\U0001f469\U0001f467"
cp.author = "作者 كاتب \U0001f4dd"
doc.add_paragraph("Body content; unicode metadata is the feature under test.")
_OUT.parent.mkdir(parents=True, exist_ok=True)
doc.save(_OUT, reproducible=True)
print(_OUT)
return 0
if __name__ == "__main__":
raise SystemExit(main())
{
"$schema": "../manifest.schema.json",
"id": "docx/core-properties-unicode",
"title": "Core properties: non-ASCII round-trip (CJK + RTL + emoji)",
"format": "docx",
"category": "metadata",
"summary": "Proves that ``dc:title`` and ``dc:creator`` round-trip bytes with non-ASCII payloads covering CJK ideographs, right-to-left Arabic, and a multi-codepoint emoji.",
"spec": {
"source": "ecma-376-5-part-2",
"clause": "11.1",
"notes": "Core-properties carry Unicode by virtue of the XML serialisation. The risk area is not the XML spec but whatever intermediate normalisation, decoding, or quoting the authoring library performs between the Python string and the emitted ``<dc:title>`` / ``<dc:creator>``. The fixture value combines a Chinese title, a short Arabic fragment, and the multi-codepoint family emoji U+1F468 U+200D U+1F469 U+200D U+1F467 to stress-test all three paths at once."
},
"fixtures": {
"machine": "docx/core-properties-unicode"
},
"generator": {
"python": "scripts/gen_core_properties_unicode.py"
},
"assertions": [
{
"id": "unicode-title-value",
"part": "docProps/core.xml",
"namespaces": {
"cp": "http://schemas.openxmlformats.org/package/2006/metadata/core-properties",
"dc": "http://purl.org/dc/elements/1.1/"
},
"xpath": "//dc:title",
"must": "equal",
"value": "测试标题 مرحبا 👨👩👧",
"description": "The <dc:title> element must preserve CJK, Arabic and emoji bytes verbatim."
},
{
"id": "unicode-creator-value",
"part": "docProps/core.xml",
"namespaces": {
"cp": "http://schemas.openxmlformats.org/package/2006/metadata/core-properties",
"dc": "http://purl.org/dc/elements/1.1/"
},
"xpath": "//dc:creator",
"must": "equal",
"value": "作者 كاتب 📝",
"description": "The <dc:creator> element must preserve CJK, Arabic and emoji bytes verbatim."
}
]
}
No rendered reference is available for this case.