pandoc-unicode-sanitize
What it does
This skill prepares a Markdown file for PDF conversion by replacing symbols that LaTeX cannot handle with plain equivalents. It is for people who write documents with currency symbols, fancy quotes or arrows.
When to use it
- ✓When my Markdown has currency symbols such as euro, pound or rupee signs and the PDF fails.
- ✓When the document has curly quotes, arrows or bullet symbols that break PDF conversion.
- ✓When I want a reusable cleanup step before every PDF conversion.
Skill link
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/pandoc-unicode-sanitize/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agent’s skills folder.
Example of what to ask your AI
“My Markdown uses rupee and euro signs and curly quotes, and the PDF conversion fails. Please clean the symbols and make the PDF.”
5 new skills a week. 1 minute to read.
How it works
The AI runs a set of text replacements on the Markdown, turning symbols into plain text such as Rs or EUR, and then converts the cleaned file with pandoc.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
Pandoc Unicode Sanitization for PDF Conversion
Problem
LaTeX (used by pandoc for PDF output) may fail or produce errors when encountering non-ASCII Unicode characters like currency symbols (₹, €, £), special quotes, or other Unicode characters not supported by the default LaTeX engine.
Solution
Pre-process Markdown files to replace problematic Unicode characters with ASCII equivalents before running pandoc PDF conversion.
Steps
1. Identify Problematic Characters
Common problematic characters include:
- Currency symbols: ₹, €, £, ¥
- Special quotes: " " ' '
- Arrows: →, ←, ↑, ↓
- Bullets: •, ◦
- Other symbols: ©, ®, ™, ±, ×, ÷, —, –
2. Create a Sed Substitution Script
Create a shell script for reusable sanitization:
#!/bin/bash
# sanitize-for-pdf.sh
sed -e 's/₹/Rs/g' \
-e 's/€/EUR/g' \
-e 's/£/GBP/g' \
-e 's/¥/JPY/g' \
-e 's/"/"/g' \
-e 's/"/"/g' \
-e "s/'/'/g" \
-e "s/'/'/g" \
-e 's/→/->/g' \
-e 's/←/<-/g' \
-e 's/•/-/g' \
-e 's/©/(c)/g' \
-e 's/®/(R)/g' \
-e 's/™/(TM)/g' \
-e 's/±/+/ -/g' \
-e 's/×/x/g' \
-e 's/÷/\//g' \
-e 's/—/--/g' \
-e 's/–/-/g' \
"$1"
3. Run Sanitization Before Pandoc
# Using the script
./sanitize-for-pdf.sh input.md > sanitized.md
pandoc sanitized.md -o output.pdf
# Or inline
cat input.md | sed 's/₹/Rs/g; s/€/EUR/g; s/£/GBP/g' | pandoc -o output.pdf
4. Alternative: Use iconv for Automatic Transliteration
For broader Unicode coverage:
iconv -f UTF-8 -t ASCII//TRANSLIT < input.md > sanitized.md
pandoc sanitized.md -o output.pdf
5. Alternative: Use XeLaTeX or LuaLaTeX Engine
If you want to preserve Unicode characters, use a Unicode-capable engine:
pandoc input.md -o output.pdf --pdf-engine=xelatex
# or
pandoc input.md -o output.pdf --pdf-engine=lualatex
Best Practices
- Sanitize files before conversion rather than debugging LaTeX errors after
- Keep a mapping of your organization's common symbols and preferred replacements
- Test with a small sample before processing large documents
- Consider using XeLaTeX/LuaLaTeX if Unicode preservation is required
- Document which characters cause issues in your specific environment
Common Error Signs
Look for these LaTeX errors that indicate Unicode issues:
Package inputenc Error: Unicode character ... not set upLaTeX Error: Unicode character ... cannot be used with pdflatex- Missing or garbled characters in the output PDF
FAQ
Which symbols are replaced?
The guide lists currency signs, curly quotes, arrows, bullets, copyright marks and dashes.
Does the original file change?
The guide writes the cleaned text to a new file, so the original stays as it was.
Can the cleanup be reused?
Yes, the guide suggests saving the replacements in a small shell script.
Details
Original description by the author
Pre-process Markdown to replace non-ASCII characters before pandoc PDF conversion
repo: HKUDS/AgentPilot
Popularity
- GitHub stars
- 7.8k
- Ranking position
- #12906
- License
- MIT
- Updated
- 11/1/2026
Comments
- …
More skills from this repository
agentpilot
7.8kHelps your agent improve a project step by step by preparing a task and running the AgentPilot loop that proposes, tests and scores changes.
openspace
7.8kHelps your agent set up OpenSpace, a tool that stores and fetches agent skills, and connect it to your AI app through MCP.
rsi-arena
7.8kHelps your agent set up and run standard AI benchmark tests, such as AIME and Terminal-Bench, to compare different improvement methods.
experiment-guide
7.8kHelps your agent plan small experiments, read their results and record findings while it investigates how to improve a program.
Similar skills
feishu-doc
394kHelps your agent read, create, and edit Feishu cloud documents, including text, images, and tables, using the document tool.
feishu-drive
394kLets your agent browse, organize, and comment on files in a Feishu cloud folder that has been shared with the bot.
feishu-perm
394kHelps your agent check and change who can access a Feishu file, choosing the smallest permission that meets your request.