I am having trouble while printing some special characters in a csv file.
I have written a script which runs a sql query, gets the result from database and prints the value in a csv file. I am using Test::CSV_XS.
The script is working fine except when it encounters data like:-
The value stored in the database is First Encounter®. I am getting the values from the database and then printing it into a csv file. But, whenever it encounters the above mentioned value, the Perl script gives following error:
combine() failed on argument: First Encounter®
Can there be a solution wherein the data which is stored in the database is "First Encounter 174". But, when it has to print in the csv file, it converts this data into First Encounter®?
I used HTML::Entities to convert "First Encounter 174" to First Encounter®. But, when I try to print the value in a csv file, it gives me the same (above mentioned) error.
Any idea how to get these characters displayed correctly in a csv file?
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.