character-encoding

Converting accented characters in PostgreSQL?

谁说胖子不能爱 提交于 2019-12-23 03:19:47
问题 Is there an existing function to replace accented characters with unadorned characters in PostgreSQL? Characters like å and ø should become a and o respectively. The closest thing I could find is the translate function, given the example in the comments section found here. Some commonly used accented characters can be searched using the following function: translate(search_terms, '\303\200\303\201\303\202\303\203\303\204\303\205\303\206\303\207\303\210\303\211\303\212\303\213\303\214\303\215

How to set run-time character set in C?

ⅰ亾dé卋堺 提交于 2019-12-23 03:17:57
问题 How to set run-time character set in the C programming language, in linux environment? For example, I want to set it to iso8859-1, utf-8, or ascii. 回答1: What printf( "%c", '\xa3') does is always the same -- it outputs one byte with the value 0xA3 (= 163) to the standard output stream. What is then shown on your screen depends on how your terminal (e.g., xterm or the Linux console) reacts to seeing a byte with value 163 written to it. That is a question of the character setting of your

Bullet “•” in XML

爱⌒轻易说出口 提交于 2019-12-23 03:09:07
问题 Similar to this question I am consuming an XML product that has some illegal chars in it. I seriously doubt I can get them to fix the problem, but I will try. In the meantime I'd like a work-around. The problem is that it contains a bullet. It renders as "•" in my source. I've tried a few encoding conversions but have not found a combination that works. (I'm not accustomed to even thinking about my encoding type, so I'm out of my element here.) So, I tried the below and it seems that str

How to change “Character Encoding” property of Rational Team Concert

半世苍凉 提交于 2019-12-23 02:56:12
问题 The Eclipse compare view shows four properties for files stored in RTC: Executable MIME Type Line Delimiter Character Encoding I know how to change the first three of them using the Eclipse or the Visual Studio client, but how can I change the “Character Encoding”? 回答1: This thread mentions: To change the file's encoding on server side, you need to load the file into an Eclipse project, then right-click the file and select " Properties ". In the Properties , set the file encoding to " UTF-8 "

Scala java.nio.charset.UnmappableCharacterException: Input length = 1

醉酒当歌 提交于 2019-12-23 02:27:07
问题 I've found several questions with similar titles, but couldn't seem to use any to resolve my issue. I Can't seem to load my .csv file: val source = io.Source.fromFile("C:/mon_usatotaldat.csv") Returns: java.nio.charset.UnmappableCharacterException: Input length = 1 So I tried: val source = io.Source.fromFile("UTF-8", "C:/mon_usatotaldat.csv") and got: java.nio.charset.IllegalCharsetNameException: C:/mon_usatotaldat.csv I guess UTF-8 wouldn't work, if the file isn't in UTF-8 format, so that

Character Encoding independent character swap

Deadly 提交于 2019-12-23 01:38:10
问题 I like to use this piece of code when I want to reverse a string. [When I am not using std::string or other inbuilt functions in C ] . As a beginner when I initially thought of this I had ASCII table in mind. I think this can work well with Unicode too. I assumed since the difference in values (ASCII etc) is fixed, so it works. Are there any character encodings in which this code may not work? char a[11],t; int len,i; strcpy(a,"Particl"); printf("%s\n",a); len = strlen(a); for(i=0;i<(len/2);i

Problems with special characters in php soap client

ε祈祈猫儿з 提交于 2019-12-23 01:21:08
问题 I have a problem related to this question. I have a web service (also using php) that returns some names. When any of them contains Swedish characters (å, ä or ö) and probably others as well i get a soapfault (looks like we got no XML document). I can however see the full (correct afaik) response using $soapcalo->__getLastResponse(). How do I handle the special characters? I have tried adding the encoding attribute (utf-8) on both client and server but without success. Edit: Excerpt of the

Get a unicode from python's str byte sequence

允我心安 提交于 2019-12-23 01:02:06
问题 I have an old django app which was saving UTF-8 strings in the database in a way that made some look like invalid utf8 when I try to fetch them in Ruby. Strings before saving were of type str in python, but when fetched from the database django was giving me a proper unicode string. When I fetch same record in rails I get a byte sequence that is identical to python's str string and ruby complains that it's an invalid byte sequence. Example: tested string was a single emoji: 🔥 before save in

How to detact the encoding using mb_detect_encoding correct?

99封情书 提交于 2019-12-22 18:49:15
问题 I want to detect encoding correct, but i found mb_detect_encoding always get error result, And I added lots of encoding_list UTF8 ISO-8859-* .... 回答1: You are trying to do something that only sometimes works. Encoding detection is not a exact "science" so the best thing you can do is to avoid it. 来源: https://stackoverflow.com/questions/1846201/how-to-detact-the-encoding-using-mb-detect-encoding-correct

nodeValue from DomDocument returning weird characters in PHP

对着背影说爱祢 提交于 2019-12-22 18:26:09
问题 So I'm trying to parse HTML pages and looking for paragraphs ( <p> ) using get_elements_by_tag_name('p'); The problem is that when I use $element->nodeValue , it's returning weird characters. The document is loaded first into $html using curl then loading it into a DomDocument. I'm sure it has to do with charsets. Here's an example of a response: "aujourd’hui". Thanks in advance. 回答1: I had the same issues and now noticed that loadHTML() no longer takes 2 parameters, so I had to find a