Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

hyphenate fix

  • Loading branch information...
commit 6f57c64d3ac0760267208e36915edeb356264f1f 1 parent f7d1cf6
@nagaozen nagaozen authored
Showing with 7 additions and 2 deletions.
  1. +7 −2 README.md
View
9 README.md
@@ -220,9 +220,14 @@ Commands:
import sys
import unicodedata
- print unicodedata.normalize("NFKD", unicode(sys.stdin.read(), "ISO-8859-1")).encode("ASCII", "ignore").lower().replace(' ', '-')
+ def not_combining(char):
+ return unicodedata.category(char) != "Mn"
- print sys.stdin.read().replace(" ", "-").lower()
+ def strip_accents(text, encoding):
+ unicode_text = unicodedata.normalize('NFD', text.decode(encoding))
+ return filter(not_combining, unicode_text).encode(encoding)
+
+ print strip_accents(sys.stdin.read(), "UTF-8").lower().replace(' ', '-')
Input: **Current Selection**
Output: **Replace the current selection**
Applicability: **All documents**
Please sign in to comment.
Something went wrong with that request. Please try again.