bevry-archive / bal-util

Utility functions for JavaScript and Node.js used and maintained by Benjamin Lupton

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

getEncodingSync error.

lethee opened this issue · comments

Docpad's articles written in Korean with UTF-8 encoding may be detected as 'binary' in balUtilPaths.getEncodingSync function.

I think the 'chunkBegin' position value of mid-chunk or last-chunk is not fit to Korean. (It uses 3 bytes for a character for Korean in utf-8)

I use modified docpad source (parseData in file.coffee) myself but I try to find solution for this problem.

if data instanceof Buffer
    encoding = balUtil.getEncodingSync(data)
    if this.get('fullPath').substr(this.get('fullPath').length-3) in ['.md', 'tml', 'htm']
        encoding = 'utf8'

http://dogfeet.github.com

I'm now checking this problem occurred only for me. (Mac 10.8, en_US.UTF-8 locale)

I update docpad (models/file.coffee)