# Full-Width to Half-Width

> Turns full-width letters, digits, symbols and spaces into half-width ones, leaving Chinese punctuation alone

Version: 1.0.0 · By Deck

- Install in Deck: deck://install-plugin?id=fullwidth-to-halfwidth&url=https%3A%2F%2Fgithub.com%2Fyuzeguitarist%2Fdeck-plugins%2Freleases%2Fdownload%2Fplugins%2Ffullwidth-to-halfwidth-1.0.0.zip
- Download .zip: https://github.com/yuzeguitarist/deck-plugins/releases/download/plugins/fullwidth-to-halfwidth-1.0.0.zip
- View on GitHub: https://github.com/yuzeguitarist/deck-plugins/tree/main/plugins/fullwidth-to-halfwidth

Or install with Terminal: 

```sh
mkdir -p ~/.deck/scripts/fullwidth-to-halfwidth && curl -fsSL https://github.com/yuzeguitarist/deck-plugins/releases/download/plugins/fullwidth-to-halfwidth-1.0.0.zip | tar -xf - -C ~/.deck/scripts/fullwidth-to-halfwidth
```

## Script

```js
// Turns full-width letters, digits and symbols into ASCII and the ideographic space into a space.
function transform(input) {
  // Full-width ! ( ) , : ; ? ~ stay: Chinese and Japanese text uses them as its own punctuation.
  const keep = "\uff01\uff08\uff09\uff0c\uff1a\uff1b\uff1f\uff5e";
  return String(input ?? "").replace(/[\u3000\uff01-\uff5e]/g, (char) => {
    if (char === "\u3000") return " ";
    return keep.includes(char) ? char : String.fromCharCode(char.charCodeAt(0) - 0xfee0);
  });
}
```

---

- HTML: https://deckclip.app/plugins/fullwidth-to-halfwidth
- 中文: https://deckclip.app/zh-cn/plugins/fullwidth-to-halfwidth.md

© 2026 Yuze Pan
