I think you've really misunderstood the PDF format. PDF is a binary format
(it can contain images with zero codepoints). There's nothing that can read
PDFs that expects them in UTF8 format.
You may have destroyed the PDFs completely by storing them as Latin-1, but
given how flexible Latin-1 is you may be OK - just deliver them as binary
and you might be OK. Set the correct Content-Type on delivery
(res.type('pdf')) and everything will work.
On Wed, Sep 30, 2015 at 2:58 AM, arpit shah <[email protected]> wrote:
> Hi All,
>
> I have been facing an issue on node.js express framework encoding/decoding
> style.
> Brief background, I store pdf file in mysql database with longblob
> data-type with latin1 charset. From server side, i need to send the binary
> data with UTF8 Encoding format as my client knows utf8 decoding format only.
> I tried all the possible solutions available on google.
>
> For ex: new Buffer(mySqlData).toString('utf8');
> Already tried module "UTF8" with given functionality
> utf8.encode(mySqlData);
>
> Also i already tried "base64" encoding and retrieve data at client with
> base64 decoding. I is working just fine but i need to have utf8 encoding
> set. Also you know base64 certainly increase the size.
>
> Please help guys.
>
> --
> Job board: http://jobs.nodejs.org/
> New group rules:
> https://gist.github.com/othiym23/9886289#file-moderation-policy-md
> Old group rules:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> ---
> You received this message because you are subscribed to the Google Groups
> "nodejs" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/nodejs/a420947c-ce4b-4cee-abb3-6daffc141616%40googlegroups.com
> <https://groups.google.com/d/msgid/nodejs/a420947c-ce4b-4cee-abb3-6daffc141616%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
Job board: http://jobs.nodejs.org/
New group rules:
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/nodejs/CAPJ5V2Z3%3DsW0sORSH6V-ssFVbgyxd_vUfganh4Ny_92HXw9JZA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.