Tag Archives: encoding

How can I change Excels default XML output encoding?

Questions: I’m working on a solution where Excel data is exported to XML. I’ve implemented a schema and I get all the data exported properly. The one problem I have is that the solution that will receive the XML files expects ISO-8859-1 encoding, while Excel by default outputs UTF-8. Is there any way to change… Read More »

Openpyxl ascii encoding error

Questions: I try to read a large xlsm file from python with following code: #!/usr/bin/env python # -*- coding: utf-8 -*- from openpyxl import load_workbook print (“01”) wb = load_workbook(“data.xlsm”, data_only=True) print (“02”) print (wb.get_sheet_names()) print (“03”) It returns: 01 /usr/lib/python3.5/site-packages/openpyxl/workbook/names/named_range.py:125: UserWarning: Discarded range with reserved name warnings.warn(“Discarded range with reserved name”) 02 Traceback (most… Read More »

ColdFusion XLS “Export” and Character Encoding

Questions: I am “exporting” data from a page to Excel using an HTML table. The table looks fine in the browser but in Excel special characters such as apostrophes, trademark symbols, etc. are improperly encoded. If I open the exported file in notepad and save it as ANSII encoded then open it in Excel everything… Read More »

Interop.Excel UTF-8 encoding when saving file

Questions: I’m having an issue saving an Excel file as a CSV with UTF-8 encoding. Because I have non standard characters (different language) in my Excel document it caused issues when saved as a CSV. This was solved here by setting the web options encoding to UTF-8. I am creating a basic C# program that… Read More »

Incorrect base64 encoding VBA

Questions: I’m trying to encode a JPG image into Base64 format for HTML (<img src=”data:image/jpg ..” />) in VBA Excel. I found a similiar question, Convert image (jpg) to base64 in Excel VBA?, and tried the code: ‘https://stackoverflow.com/questions/2043393/convert-image-jpg-to-base64-in-excel-vba Sub EncodeFile() Dim strPicPath: strPicPath = “MyDriveHere:\SomePath\image.jpg” ‘Credit to Wikipedia for orange picture: ‘https://upload.wikimedia.org/wikipedia/commons/thumb/1/10/Citrus_reticulata_April_2013_Nordbaden.JPG/220px-Citrus_reticulata_April_2013_Nordbaden.JPG Const adTypeBinary =… Read More »

Issue with UTF-/ encoding on csv file for excel

Questions: EDIT: As suggested special chars are displayed correctly if I use notepad++ to open the csv file. They are displayed correctly too when I import the csv file into excel. How can I generate a csv file that is displayed correctly when opened by excel since file importing is not an option for the… Read More »

MsSQL encoding issue

Questions: i have a database in MsSQL, with which i connect from my PHP code through PDO objects. the database has column “Kadź”. Now – if i execute a SELECT Kadź FROM <tablename> query from my SQL Server Management Studio – everything works fine, i get the results. However, when i try to execute a… Read More »

Cyrillic encoding in C#

Questions: I have a bunch of Cyrillic-like text in a MSSQL database and need to convert it to Cyrillic in C#. So… Ðàáîòà â ãåðìàíèè should become Работа в германии Any suggestions? I should add that the closest I’ve gotten is ?aaioa a aa?iaiee Here’s the code I’m using: str = Encoding.UTF8.GetString(Encoding.GetEncoding(“Windows-1251”).GetBytes(drCurrent[“myfield”].ToString())); str = Encoding.GetEncoding(1251).GetString(Encoding.Convert(Encoding.UTF8,… Read More »

HttpServletRequest UTF-8 Encoding [duplicate]

Questions: This question already has an answer here: How to pass Unicode characters as JSP/Servlet request.getParameter? 4 answers Answers: Paul’s suggestion seems like the best course of action, but if you’re going to work around it, you don’t need URLEncoder or URLDecoder at all: String item = request.getParameter(“param”); byte[] bytes = item.getBytes(StandardCharsets.ISO_8859_1); item = new… Read More »

Guessing the encoding of text represented as byte[] in Java

Questions: Given an array of bytes representing text in some unknown encoding (usually UTF-8 or ISO-8859-1, but not necessarily so), what is the best way to obtain a guess for the most likely encoding used (in Java)? Worth noting: No additional meta-data is available. The byte array is literally the only available input. The detection… Read More »