latin1

How to store characters like ♥☆ to DB?

烂漫一生 提交于 2019-12-11 18:35:23
问题 Previous issue - was not able to store non-english characters: How to store non-english characters? That was fixed by using UTF8. But realized today that symbols like ♥☆ are not stored correctly. They get converted to characters like ♥☆ . How can this be fixed? 回答1: Is UTF8 used consistently across the whole spectrum (MySQL, PHP, Apache, <meta>s, headers..)? For me this worked out of the box: $query = "update tbl set col = '♥☆' where id = 1"; mysql_query($query) or die(mysql_error());

how to convert é,ê,… in database mysql to the normal string é,â,… using php?

丶灬走出姿态 提交于 2019-12-11 14:55:52
问题 There are the problems of data in mysql. Some data store with the string like (1): "hello & hello ' hello è ..." . And some data store with the string like (2): "hello à hello é hello ê ..." . I can solve the string (1) to the normal string, but I don't know how to convert the string (2) to the normal string? Note : We can not change the data in the existing database :/ Also the both sample is store in the same table and the charset of the table is latin1! 回答1: hello à hello é hello ê

best character set and collation for storing Tags, and URLs in MySQL DB

核能气质少年 提交于 2019-12-11 10:52:49
问题 I'm retrieving photos info from Flickr into my site. For each photo, the URL, title, and tags are saved in MySQL database. I read a lot about the most suited character set for such values and I found its mostly between using utf8 or latin1. Some titles and tags include symbols like the copyright (or similar ones). Will I be OK with Latin1 character set? 回答1: Never use utf-8 in your database if the stored text is 100% ascii. Bloating each character with utf-8 could imply a significant

Latin1 to UTF8 conversion

我是研究僧i 提交于 2019-12-11 07:00:03
问题 Before answring to my problem, Keep this in mind: I have searched for this problem many sites including mysql forum and stackoverflow. No answer solved my problem... I have Mysql database encoded as latin1(Arabic characters), with huge data inserted as text and varchar. I am trying to convert it to UTF8. I have tried different conversion methods, I got data corruption when displayed in html as utf8 header. Have any one tried this?? Please help 来源: https://stackoverflow.com/questions/17193392

Forcing encoding & decoding with Doctrine 2

南楼画角 提交于 2019-12-11 03:17:12
问题 I'm working with a legacy big ball of mud that uses a latin1 database but works with utf8 strings. Each time the application reads or writes to database, it decodes or encodes by hand and stores utf8 encoded strings in the latin1 database. When writing, it does something like: $value = utf8_encode("Iñtërnâtiônàlizætiøn") mysql_query("INSERT INTO table (key) VALUES ($value)") So the stored value is Iñtërnâtiônà lizætiøn And when reading: $result = mysql_query("SELECT key FROM table")

Python and string accents

大憨熊 提交于 2019-12-11 00:49:35
问题 I am making a web scraper. I access google search, I get the link of the web page and then I get the contents of the <title> tag. The problem is that, for example, the string "P\xe1gina N\xe3o Encontrada!" should be "Página Não Encontrada!" . I tried do decode to latin-1 and then encode to utf-8 and it did not work. r2 = requests.get(item_str) texto_pagina = r2.text soup_item = BeautifulSoup(texto_pagina,"html.parser") empresa = soup_item.find_all("title") print(empresa_str.decode('latin1')

Python converting latin1 to UTF8

醉酒当歌 提交于 2019-12-09 15:28:44
问题 In Python 2.7, how do you convert a latin1 string to UTF-8. For example, I'm trying to convert é to utf-8. >>> "é" '\xe9' >>> u"é" u'\xe9' >>> u"é".encode('utf-8') '\xc3\xa9' >>> print u"é".encode('utf-8') é The letter is é which is LATIN SMALL LETTER E WITH ACUTE (U+00E9) The UTF-8 byte encoding for is: c3a9 The latin byte encoding is: e9 How do I get the UTF-8 encoded version of a latin string? Could someone give an example of how to convert the é? 回答1: To decode a byte sequence from latin

How to correct the encoding of characters on a data.frame

Deadly 提交于 2019-12-08 04:00:22
问题 I have a data frame make like this: data.names<-data.frame(DATA=c(1:5)) rownames(data.names)<-c("IV\xc1N","JOS\xc9","LUC\xcdA","RAM\xd3N","TO\xd1O") data.names # DATA # IV\xc1N 1 # JOS\xc9 2 # LUC\xcdA 3 # RAM\xd3N 4 # TO\xd1O 5 I want the incorrect letters replace by the right ones (Á,É,Í,...). Make clear that I want to use apply because I read that is much more efficient apply than for. My idea is make a function that changes these letters: letters1<-c("\xc1","\xc9","\xcd","\xd3", "\xd1")

MySql varchar change from Latin1 to UTF8

余生长醉 提交于 2019-12-06 11:26:21
问题 In a mySql table I'm using Latin1 character set to store text in a varchar field. As our website now is supported in more countries we need support for UTF8 instead. What will happen if I change these fields to UTF8 instead? Is it secure to do this or will it mess up the data inside these fields? Is it something I need to think about when changing the field to UTF8? Thanks! 回答1: MySQL handles this nicely: CREATE TEMPORARY TABLE t1 ( c VARCHAR(10) ) CHARACTER SET ="latin1"; INSERT INTO t1

Utf-8 characters displayed as ISO-8859-1

瘦欲@ 提交于 2019-12-05 16:20:58
I've got an issue with inserting/reading utf8 content from a db. All verifications I'm doing seem to point to the fact that the content in my DB should be utf8 encoded, however it seems to be latin encoded. The data are initially imported from a PHP script from the CLI. Configuration: Zend Framework Version: 1.10.5 mysql-server-5.0: 5.0.51a-3ubuntu5.7 php5-mysql: 5.2.4-2ubuntu5.10 apache2: 2.2.8-1ubuntu0.16 libapache2-mod-php5: 5.2.4-2ubuntu5.10 Vertifications: -mysql: mysql> SHOW VARIABLES LIKE 'character_set%'; +--------------------------+----------------------------+ | Variable_name | Value