character-encoding

Convert Text to Unicode Escape Sequence

余生颓废 提交于 2021-02-08 04:37:25
问题 I have a Text object that contains some number of Latin characters that needs to be converted to a unicode escape sequence of the format \u#### with # being hex digits As described here, haskell easily converts strings to escape sequences and vice versa. However, it will only go to the decimal representation. For example, > let s = "Ñ" > s "\209" Is there a way to specify the escape sequence encoding to force it to spit out in the correct format? i.e > let s = encodeUnicode16 "Ñ" > s "\u00d1"

Delphi - Get Windows' default non-unicode character set

瘦欲@ 提交于 2021-02-07 20:11:04
问题 I have a Delphi 7 application. I need to be able to get the default Windows character set for non-unicode programs. I know DEFAULT_CHARSET sets it, but I need to know exactly which charset it is, so that I could compare it to other character sets. Is this possible and how? Thanks! 回答1: GetFontData is calling GetObject and using LogFont.lfCharSet to determine the charset GetObject called with HFONT will fill LogFont Definition here is DEFAULT_CHARSET is set to a value based on the current

How does gcc decide the wide character set when calling `mbtowc()`?

倖福魔咒の 提交于 2021-02-07 19:33:30
问题 According to the gcc manual, the option -fwide-exec-charset specifies the wide character set of wide string and character constants at compile time. But what is the wide character set when converting a multi-byte character to a wide character by calling mbtowc() at run time? The POSIX standard says that the character set of multi-byte characters is determined by the LC_CTYPE category of the current locale, but says nothing about the wide character set. I don't have a C standard at hand now so

PotgreSQL- ERROR: invalid byte sequence for encoding “UTF8”: 0xeb 0x6e 0x74

被刻印的时光 ゝ 提交于 2021-02-07 11:00:46
问题 I am working on PostgreSQL and getting below error during insert statement execution from batch script(command line). ERROR: invalid byte sequence for encoding "UTF8": 0xeb 0x6e 0x74 I have checked client_encoding by show client_encoding command and it is showing UTF-8. Also checked database properties by using command select * from pg_database where datname='<mydbName>' In Output : datcollate = English_United States.1252 datctype = English_United States.1252 How to resolve this issue? 回答1:

PotgreSQL- ERROR: invalid byte sequence for encoding “UTF8”: 0xeb 0x6e 0x74

允我心安 提交于 2021-02-07 11:00:31
问题 I am working on PostgreSQL and getting below error during insert statement execution from batch script(command line). ERROR: invalid byte sequence for encoding "UTF8": 0xeb 0x6e 0x74 I have checked client_encoding by show client_encoding command and it is showing UTF-8. Also checked database properties by using command select * from pg_database where datname='<mydbName>' In Output : datcollate = English_United States.1252 datctype = English_United States.1252 How to resolve this issue? 回答1:

How is it so that these character constants have negative values?

空扰寡人 提交于 2021-02-07 10:56:18
问题 Reading K&R 1st paragraph page 44 Chapter 2 - The definition of C guarantees that any character in the machine's standard printing set will never be negative, so these characters will always be positive quantities in expressions. Well enough, but when I run the following code #include <stdio.h> int main(void) { printf("%d", '£'); return 0; } I get -93 as the output. I will just cite some of the negative values I get along with the corresponding characters: ÿ = -1 , þ = -2 , ÷ = -9 . I don't

Testing special characters with PHP Unit

…衆ロ難τιáo~ 提交于 2021-02-07 08:20:07
问题 I am testing my controller from Symfony2 with PHPUnit and the class WebTestCase return self::$client->request( 'POST', '/withdraw', array("amount" => 130), array(),array()); $this->assertEquals( "You can withdraw up to £100.00.", $crawler->filter("#error-notification")->text()); But I get this error: Expected: "You can withdraw up to £100.00." Actual: "You can withdraw up to £100.00." The thing is that in the webpage and the source code it looks fine, so I am thinking that maybe PHPUnit is

Testing special characters with PHP Unit

十年热恋 提交于 2021-02-07 08:17:27
问题 I am testing my controller from Symfony2 with PHPUnit and the class WebTestCase return self::$client->request( 'POST', '/withdraw', array("amount" => 130), array(),array()); $this->assertEquals( "You can withdraw up to £100.00.", $crawler->filter("#error-notification")->text()); But I get this error: Expected: "You can withdraw up to £100.00." Actual: "You can withdraw up to £100.00." The thing is that in the webpage and the source code it looks fine, so I am thinking that maybe PHPUnit is

Writing out results from python to csv file [UnicodeEncodeError: 'charmap' codec can't encode character

六眼飞鱼酱① 提交于 2021-02-07 08:12:31
问题 I've been trying to write a script that would potentially scrape the list of usernames off the comments section on a defined YouTube video and paste those usernames onto a .csv file. Here's the script : from selenium import webdriver import time import csv from selenium.webdriver.common.keys import Keys from bs4 import BeautifulSoup as soup driver=webdriver.Chrome() driver.get('https://www.youtube.com/watch?v=VIDEOURL') time.sleep(5) driver.execute_script("window.scrollTo(0, 500)") time.sleep

Java Charset problem on linux

巧了我就是萌 提交于 2021-02-06 15:53:14
问题 problem: I have a string containing special characters which i convert to bytes and vice versa..the conversion works properly on windows but on linux the special character is not converted properly.the default charset on linux is UTF-8 as seen with Charset.defaultCharset.getdisplayName() however if i run on linux with option -Dfile.encoding=ISO-8859-1 it works properly.. how to make it work using the UTF-8 default charset and not setting the -D option in unix environment. edit: i use jdk1.6