character-encoding

Java console not reading in Chinese characters correctly

a 夏天 提交于 2020-01-01 09:15:18
问题 I am struggling to get Eclipse to read in Chinese characters correctly, and I am not sure where I may be going wrong. Specifically, somewhere between reading in a string of Chinese (simplified or traditional) from the console and outputting it, it gets garbled. Even when outputting a large string of mixed text (English/Chinese characters), it appears to only alter the appearance of the Chinese characters. I have cut it down to the following test example and explicitly annotated it with what I

Can the French and Spanish special chars be held in a varchar?

早过忘川 提交于 2020-01-01 08:36:22
问题 French and Spanish have special chars in them that are not used in normal English (accented vowels and such). Are those chars supported in a varchar? Or do I need a nvarchar for them? (NOTE: I do NOT want a discussion on if I should use nvarchar or varchar.) 回答1: What SQL Implementation(s) are you talking about? I can speak about Microsoft Sql Server; other SQL implementations, not so much. For Microsoft SQL Server, the default collation is SQL_Latin1_General_CP1_CI_AS (Latin 1 General, case

Rails utf-8 problem

☆樱花仙子☆ 提交于 2020-01-01 08:30:13
问题 I there, I'm new to ruby (and rails) and having som problems when using Swedish letters in strings. In my action a create a instance variable like this: @title = "Välkommen" And I get the following error: invalid multibyte char (US-ASCII) syntax error, unexpected $end, expecting keyword_end @title = "Välkommen" ^ What's happening? EDIT: If I add: # coding: utf-8 at the top of my controller it works. Why is that and how can I slove this "issue"? 回答1: See Joel spolsky's article "The Absolute

Javamail changing charset of subject line

…衆ロ難τιáo~ 提交于 2020-01-01 04:30:10
问题 I am using Javamail (javax.mail) to send mails. I successfully adjusted contents of my mail as utf-8. However I could not set subject line as a utf-8 encoded string. I tried even mail.setSubject(new String(subject.getBytes("utf-8"), "utf-8")); on subject however it still sends as Cp1252. Example headers from mail are given below: Any ideas? example from mail headers http://m.friendfeed-media.com/a328a80db12f3c17a8aed06be106045354355abf 回答1: You should use setSubject(String subject, String

Programmatically determine number of strokes in a Chinese character?

▼魔方 西西 提交于 2020-01-01 04:29:07
问题 Does Unicode store stroke count information about Chinese, Japanese, or other stroke-based characters? 回答1: A little googling came up with Unihan.zip, a file published by the Unicode Consortium which contains several text files including Unihan_RadicalStrokeCounts.txt which may be what you want. There is also an online Unihan Database Lookup based on this data. 回答2: In Python there is a library for that: >>> from cjklib.characterlookup import CharacterLookup >>> cjk = CharacterLookup('C') >>>

How can I use Turkish characters like 'ş ç ı ö' in an Android TextView?

有些话、适合烂在心里 提交于 2020-01-01 00:48:14
问题 I want to write 'ile' in android TextView but it isn't drawn correctly. How can use characters like this? For example I set the my textview as 'çile' it shows as '?ile' instead; how can I fix this? 回答1: This answer solved my problems for turkish characters. https://stackoverflow.com/a/9312031/218198 回答2: Try the following and see if it helps (source): String description = "Turkish characters here"; TextView tv = (TextView) findViewById(R.id.description); tv.setText(Html.fromHtml(description)

PHP: Problems converting “’” character from ISO-8859-1 to UTF-8

ぃ、小莉子 提交于 2019-12-31 17:12:27
问题 I'm having some issues with using PHP to convert ISO-8859-1 database content to UTF-8. I am running the following code to test: // Connect to a latin1 charset database // and retrieve "Georgia O’Keeffe", which contains a "’" character $connection = mysql_connect('*****', '*****', '*****'); mysql_select_db('*****', $connection); mysql_set_charset('latin1', $connection); $result = mysql_query('SELECT notes FROM categories WHERE id = 16', $connection); $latin1Str = mysql_result($result, 0);

Django set Storage Engine & Default Charset

天涯浪子 提交于 2019-12-31 10:47:11
问题 Creating my tables from my models.py . I donno how to do 2 things - I want to specify MySQL to create some of my tables as InnoDB & some as MyISAM . How do I do it? Also I want to specify my tables DEFAULT CHARSET as utf8 . How do I do it? This is what I see when I run syncdb - ... ) ENGINE=MyISAM DEFAULT CHARSET=latin1 I use Ubuntu 10.04, Django 1.2.X, MySQL 5.1.X UPDATE : I thought these might be MySQL default settings & I ended up changing my.cnf where I added default-character-set = utf8

Replace diacritic characters with “equivalent” ASCII in PHP?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-31 08:49:07
问题 Related questions: How to replace characters in a java String? How to replace special characters with their equivalent (such as " á " for " a") in C#? As in the questions above, I'm looking for a reliable, robust way to reduce any unicode character to near-equivalent ASCII using PHP. I really want to avoid rolling my own look up table. For example (stolen from 1st referenced question): Gračišće becomes Gracisce 回答1: The iconv module can do this, more specifically, the iconv() function: $str =

The £ sign is shown as a diamond with a question mark in the middle

蹲街弑〆低调 提交于 2019-12-31 07:43:48
问题 I'm creating a webapp which involves displaying financial data to the user. Being from the UK and using GBP £ for currency, this character is used a lot. However, every now and then, the £ is shown as a diamond with a question mark in the middle, and on the web page it throws an invalid charachter UTF-8 byte 1 of 1 byte string. Is there a UTF safe way to display the £ sign? Here is an example of what I am doing at the moment: "Rent Per Annum: £" + '${tenant.currentRent}' 回答1: The particular