forgive ~ as well (#513)
localeToCharset() may return NA or a vector of length > 1

see this post http://cos.name/cn/topic/109968
link to a real example for FAQ 9
- is a special character in [], so must put in the end (or beginning); 24635850 was a careless fix
factor the part of sanitizing filename for tex into a function for easier testing purpose
matrix[FALSE, ] returns a matrix of 0 row, so need to check nrow(cfg)
shoot, I should put - inside []