File name fix and character encoding fix

1) File name was not being set properly (always using "download")
2) Sometimes it's neede to use an octet-stream instead of a base64 string in order to avoud encoding issues with characters like "ñ"