Ensure String.charAt returns empty string for out of range (fix #305)