diff --git a/smartypants.go b/smartypants.go
index 589feb0..797de91 100644
--- a/smartypants.go
+++ b/smartypants.go
@@ -256,6 +256,7 @@ func smartBacktick(out *bytes.Buffer, smrt *smartypantsData, previousChar byte,
func smartNumberGeneric(out *bytes.Buffer, smrt *smartypantsData, previousChar byte, text []byte) int {
if wordBoundary(previousChar) && len(text) >= 3 {
// is it of the form digits/digits(word boundary)?, i.e., \d+/\d+\b
+ // note: check for regular slash (/) or fraction slash (⁄, 0x2044, or 0xe2 81 84 in utf-8)
numEnd := 0
for len(text) > numEnd && isdigit(text[numEnd]) {
numEnd++
@@ -264,15 +265,18 @@ func smartNumberGeneric(out *bytes.Buffer, smrt *smartypantsData, previousChar b
out.WriteByte(text[0])
return 0
}
- if len(text) < numEnd+2 || text[numEnd] != '/' {
+ denStart := numEnd + 1
+ if len(text) > numEnd+3 && text[numEnd] == 0xe2 && text[numEnd+1] == 0x81 && text[numEnd+2] == 0x84 {
+ denStart = numEnd + 3
+ } else if len(text) < numEnd+2 || text[numEnd] != '/' {
out.WriteByte(text[0])
return 0
}
- denEnd := numEnd + 1
+ denEnd := denStart
for len(text) > denEnd && isdigit(text[denEnd]) {
denEnd++
}
- if denEnd == numEnd+1 {
+ if denEnd == denStart {
out.WriteByte(text[0])
return 0
}
@@ -280,7 +284,7 @@ func smartNumberGeneric(out *bytes.Buffer, smrt *smartypantsData, previousChar b
out.WriteString("")
out.Write(text[:numEnd])
out.WriteString("⁄")
- out.Write(text[numEnd+1 : denEnd])
+ out.Write(text[denStart:denEnd])
out.WriteString("")
return denEnd - 1
}