utf-8

Problems making http-post requests with German umlauts (ä ö ü) or special chars (ß) with Node.js

若如初见. 提交于 2020-01-06 02:52:06
问题 TLDR; solved, see comments below :) I am really getting nuts with this: I want to post JSON to the Redmine API to send time entries imported via CSV files. Everything works well, until I try to send strings with German umlauts (ä ü ö) or special chars (ß). I am using the request package with the following code: var options = { url: self.getHost() + path, headers: { 'Content-Type': 'application/json; charset=utf-8' }, method: method }; options.headers[self.getApiKeyHeader()] = self.getApiKey()

In Qt, how to setCodecForCStrings globally (in header)?

萝らか妹 提交于 2020-01-06 02:38:08
问题 I'm developing a bunch of Qt applications in C++ and they all use some modules (translation units) for common functionality that use Qt as well. Whenever I convert a C string (implicit conversion) or C++ string object (fromStdString()) to a QString object, I expect the original data to be UTF-8 encoded and vice versa (toStdString()). Since the default is Latin-1, I have to set the codec "manually" (in the init procedure of every one of my programs) to UTF-8: QTextCodec::setCodecForCStrings

Fixtures: How to load utf-8 characters and convert to non utf-8 and save into database?

匆匆过客 提交于 2020-01-06 01:16:07
问题 I am new to Rails. I am working on a legacy code which relies on Fixtures to load non UTF8 characters from yml files into database. With rails lastest version, the yml must be utf-8 encoding, meaning that what Fixtures read in will be utf-8 encoding. How to convert the following codes so that it will convert from utf-8 to non-utf8 and load into database (non-utf8 encoding of course). class LoadUsersData < ActiveRecord::Migration def self.up down directory = File.join(File.dirname(__FILE__))

Encoding error in Django on Heroku

老子叫甜甜 提交于 2020-01-05 17:30:34
问题 I see some topics where people say to use this command to solve the problem heroku config:add LANG=en_US.UTF-8 I did it already but keep getting encoding problem, like this UnicodeEncodeError at /admin/controladoria/orgao/2/ 'ascii' codec can't encode character u'\xe7' in position 23: ordinal not in range(128) if I try to run the command above it is what I got.... daniel@daniel-VirtualBox: (dev *) $ heroku config:add LANG=en_US.UTF-8 Setting config vars and restarting rocky-hollows-8072...

TSQL FOR XML Exporting ACTUAL UTF-8 Encoded data

て烟熏妆下的殇ゞ 提交于 2020-01-05 14:54:26
问题 We have a process that writes XML (Using SQL's FOR XML). When it was executed via SQLCMD in a batch file the output was in UTF-8 format (specifically 8-bit ascii characters become 2 byte). When I do the same thing through Execute SQL Command in SSIS it's not UTF-8 encoded. Here's a simple example. The ® should become 2 bytes: SELECT 'Diversity® Certified' as fldAgentLastName FOR XML PATH('agent'), ELEMENTS, TYPE, ROOT('agents') The output is: Diversity® Certified it SHOULD be: Diversity®

Python Character Encoding European Accents

狂风中的少年 提交于 2020-01-05 12:35:57
问题 I know this is not an uncommon problem and that there are already multiple SO questions answered about this (1, 2, 3) but even in following the recommendations there, I am still seeing this error (for the below code): uri_name = u"%s_%s" % (name[1].encode('utf-8').strip(), name[0].encode('utf-8').strip()) UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 4: ordinal not in range(128) So I am trying to get a url from a list of artist names, a lot of which have accents and

Python Character Encoding European Accents

狂风中的少年 提交于 2020-01-05 12:35:08
问题 I know this is not an uncommon problem and that there are already multiple SO questions answered about this (1, 2, 3) but even in following the recommendations there, I am still seeing this error (for the below code): uri_name = u"%s_%s" % (name[1].encode('utf-8').strip(), name[0].encode('utf-8').strip()) UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 4: ordinal not in range(128) So I am trying to get a url from a list of artist names, a lot of which have accents and

Can I get a single canonical UTF-8 string from a Unicode string?

末鹿安然 提交于 2020-01-05 10:29:27
问题 I have a twelve-year-old Windows program. As may be obvious to the knowledgeable, it was designed for ASCII characters, not Unicode. Most of it has been converted, but there's one spot that still needs to be changed over. There is a serious constraint on it though: the exact same ASCII byte sequence MUST be created by different encoders, some of which will be operating on non-Windows systems. I'm trying to determine whether UTF-8 will do the trick or not. I've heard in passing that different

Spring MVC: How to store € character?

丶灬走出姿态 提交于 2020-01-05 10:10:17
问题 I am using Spring 3 MVC and I have setup a form to capture input from a user. This form includes a textarea for a description String in my model object, Event. My corresponding controller looks like this: @RequestMapping(value = "/admin/event/{eventId}/edit", method = RequestMethod.POST) public String updateEvent(@ModelAttribute Event event) { logger.info("updateEvent(): Event description: " + event.getDescription()); return "redirect:/admin/event/" + event.getId() + "/edit"; } Whenever I

PhantomJS arguments.js example UTF-8 not working

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-05 08:43:29
问题 NOTE : This might be related to the question I already asked Highcharts export server special characters replaced with question mark. The PhantomJS arguments.js example returns the parameters you give. Example : phantomjs arguments.js a b c Returns : 0: arguments.js 1: a 2: b 3: c On Mac OS X with PhantomJS 1.9.0 installed, I have no problem returning arguments with special characters. But on the remote server I'm working with (Linux Debian 6), it does not work as expected : phantomjs