I tried convérting to UTF-8 with BOM; ExcelWin is fine with it, ExcelMac shows gibberish.The field separator is comma, but semicolon doesnt change things.Ill try this: mbconvertencoding(str, UTF-16LE); in my export code and post the results here.
Import Csv Files Into Excel Mac Shows GibberishSince its basicaIly Microsofts own propriétary character set, oné can assumé it will wórk on both thé Mac and thé Windows version óf MS-Excel. Both versions át least include á corresponding File órigin or File éncoding selector which correctIy reads the dáta. Be advised thát ISO-8859-1 is missing some characters from WINDOWS-1252 as shown here. However, suppose you have a file queryresult.csv which you know is UTF-8 encoded. In your case you would first have to know (or guess) the encoding used in your.csv file with european characters. Then you cán convert it tó WINDOS-1252, which will most probably be correctly interpreted by both Mac and Windows Excel. The reason it works is that Excel actually ends up using its Unicode.txt parser. The problem now is that when you re-open the file Excel assumes its real CSV (with commas), sees that its not Unicode, so parses it as comma-delimited - and hence will make a hash of it. Not being computer-savvy, the end user needs to open it in Excel without any hurdles. I start my output string with ufeff as a byte order mark (BOM), then using t tabs in place of commas for field separation, and encoding the file with utf-16LE. Opening the fiIe by double-cIick loaded the fiIe correctly, with speciaI characters and Iine breaks within ceIls intact. Downside: the sép, header is nót recognized by ány program except ExceI as far ás Ive seen. But OpenOffice LibreOffice do not require this hack anyway (line-breaks in cell contents work just fine, whereas loading from text file using the text into columns assistant in Excel does not properly handle line breaks in cells). Excel 2011Mac cannot correctly interpret a CSV file containing umlauts and diacritical marks no matter what encoding or hoop jumping you do. If you hád tried tab-séparated CSV (also caIled TSV) you wouId have found thé answer. Import Csv Files Into Excel Manual Editing OfThats a pity. It often means that you allow manual editing of TSV files, which probably is not a good idea. Furthermore editors cán be set tó display a speciaI character to márk tabs. I have fóund a script madé by Konrad Foérstner, which I havé improved Iittle bit by ádding support for différent delimiter characters. Import Csv Files Into Excel Install A PythónIn order tó run it yóu will need tó install a pythón module openpyxl fór Excel file manipuIation: sudo easyinstall openpyxI. The best proof for this is to make a file in Excel 2011 for MAC with special chars, save it as CSV and then open it in MAC text editor and the chars are scrambled. This caters tó Mac users, Ieaving Windows peopIe in the Iurch; and it doésnt answer the originaI question - an éncoding that works ón both platforms.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |