The HWP‑to‑Markdown Problem Nobody Talks About (and a FreeType Gotcha)
说明与用途
韩国 .hwp 文件转换为 Markdown 的问题通过使用 rhwp-python 解析 ZIP 容器、正确处理表格并预加载 FreeType 以避免崩溃得到解决,从而实现无缝集成到 LLM 流水线。
问题
Korean .hwp files are common in government and enterprise, but there is no easy way to convert them to text for LLM pipelines, and font‑rendering libraries can crash services.
结果
The conversion tool normalizes HWP documents into Markdown, enabling consistent processing across formats and eliminating format‑specific glue code. It also resolves a subtle FreeType loading bug that caused intermittent crashes.
工作流
- 1. Use rhwp-python to parse the HWP ZIP container and extract structured text and paragraphs.
- 2. Convert tables by tracking row/column positions to preserve data order.
- 3. Preload the FreeType shared library via ctypes before importing any library that uses it, ensuring a single instance is used.
- 4. Output the extracted content as Markdown.
- 5. Feed the Markdown into the existing RAG/LLM pipeline.
- 6. Publish the tool as a free utility at https://www.knowverse.net/en/util/.
证据
Modern .hwp (and .hwpx) files are structured containers, closer to OOXML than to a flat binary blob.
The parsing step pulled in a FreeType dependency for font metrics, and it segfaulted intermittently under load — but only on the server, never locally.
- 记录日期: 2026-09-18T18:15:29.203Z