utf-8

Do HTTP request headers have to be UTF-8 encoded?

I could not find anything in the spec which says it should be. I have seen a couple of browsers setting their user-agents to non UTF8 encoded strings. There is however a Content-Type request header which specifies the media type (and charset), and I'm not sure if that is applicable only to the body of the request or the headers too. ...

Charset and UTF-8 in a downloaded text file on a Mac

We have a PHP/MYSQL application that collects user input, including special characters like ø,ü,ñ, etc Database is capturing them, and they can be seen via PHPmyAdmin. Download on windows is fine. Display on a mac browser is fine. When users download the text file on a Mac OSX, the unicode characters come out as other characters. If ...

Why does my UTF8 data from my mod_perl application still get garbled in the web browser?

Before I begin, I would like to highlight the structure of what I am working with. There is a text file from which a specific text is taken. The file is encoded in utf-8 Perl takes the file and prints it into a page. Everything is displayed as it should be. Perl is set to use utf-8 The web page Perl generates has the following header <...

Sending Email in PHP with special characters

I have a small web form which will cause a PHP script to send a receipt upon clicking the submit button, by an HTML mail. This mail contains special characters, namely 'å', 'ä' and 'ö'. Whatever I try, I can't get these characters to display properly everywhere. In some email clients, these characters show up just fine, whereas in others...

Problem in utf-8 encoding PHP + MySQL

hi,i moved data from mysql 4 (they were originally set to latin2 encoding) to mysql 5 and set encoding to utf-8. It looks good in phpMyAdmin, utf-8 is ok. But there are question marks instead of some characters on website! website encoding is also set to utf8 so i dont understand where is the problem. PHP and HTML files are also set to ...

PowerShell scripts on GitHub

PowerShell $OutputEncoding defaults to ASCII. PowerShell by default represents strings in Unicode. When I create scripts using the ISE, they are created in Unicode. The following command sends text to a file in Unicode: echo Testing > test.txt When I push these files to GitHub, the code view chokes on them because they aren't UTF-8...

Send emails with international accent and special characters

I am sending a newsletter via PHP mail() in Spanish, they have accents and special characters (which I'm going to try to paste here: á, í, é, ñ ...). For the HTML version of the email, I think I solved the issue by printing &#225;, &#233; ... However for the plain text version, I assume I can't put those, right? What is the best thing...

preg_match and UTF-8 in PHP

I'm trying to search a UTF8-encoded string using preg_match. preg_match('/H/u', "\xC2\xA1Hola!", $a_matches, PREG_OFFSET_CAPTURE); echo $a_matches[0][1]; This should print 1, since "H" is at index 1 in the string "¡Hola!". But it prints 2. So it seems like it's not treating the subject as a UTF8-encoded string, even though I'm passing...

Arabic characters corrupt on landing, fine after refresh - UTF8

I have an php page with mixed Latin and Arabic characters. The charset declaration tag is in the html code and the file is saved as UTF-8. All the text is static and in the php file (does not come from a DB or an external source) When I browse to the site some pages randomly get corrupt in IE and FF and display all question marks. Aft...

Netbeans unicode problems

I am switching to Netbeans for php programming (I currently use gedit). Some characters from the original source code ( à, á, é, è, etc.) are not shown in Netbeans, regardless of the fount used, and a little quotation mark is shown instead. Those files are shown perfectly in both gedit and firefox. If I modify the file in Netbeans, cha...

Internet Explorer blocked file download; file of "Unknown File Type"

I'm developing a front-end to a Rails application. In cross-browser testing, I immediately discovered that Internet Explorer (apparently all modern versions, but at least IE 7 and IE 8) is not correctly interpreting a file I'm trying to load via AJAX (with jQuery) as JavaScript. A file download warning appears and the user needs to confi...

Collate information missing when converting a MySQL table from Latin1 to UTF8

I'm converting an existing table such as this: CREATE TABLE `example`(`id` int(10) unsigned NOT NULL AUTO_INCREMENT, `column1` char(32) COLLATE latin1_general_ci NOT NULL DEFAULT '', `column2` char(64) COLLATE latin1_general_ci NOT NULL ...

How can I set the default file format in the Delphi IDE to UTF8?

Delphi 2009 sets the default file format for new source code files to ANSI, this makes the source code platform-dependent. Even for a new XSD file created in the IDE, which by default starts with this line <?xml version="1.0" encoding="UTF-8" ?> Delphi sets the file format to ANSI (this looks like a bug, for new XML and XSLT document...

File open error by using codec utf-8 in python

I execute following code on windows xp and python 2.6.4 But it show IOError. How to open file whose name has utf-8 codec. >>> open( unicode('한글.txt', 'euc-kr').encode('utf-8') ) Traceback (most recent call last): File "<pyshell#0>", line 1, in <module> open( unicode('한글.txt', 'euc-kr').encode('utf-8') ) IOError: [Errno 22] inva...

Zend_JSON:Encode messing up - why!?!??!

My Zend_Json is messing up in encoding an object here. I'm encoding an associative array which has two elements: Element one is another associative array while element 2 is an HTML string. He's goofing up such that the Html string part contains just NULL!!?!?!?!? Heres the element UNencoded when I do a var_dump on it...sorry for the loo...

Using UTF-8 charset with PHP - are mb functions required?

These past few days I've been working toward converting my PHP code base from latin1 to UTF-8. I've read the two main solutions are to either replace the single byte functions with the built in multibyte functions, or set the mbstring.func_overload value in the php.ini file. But then I came across this thread on stack overflow, where th...

Ruby: Convert encoded character to actual UTF-8 character

Ruby will not play nice with UTF-8 strings. I am passing data in an XML file and although the XML document is specified as UTF-8 it treats the ascii encoding (two bytes per character) as individual characters. I have started encoding the input strings in the '\uXXXX' format, however I can not figure out how to convert this to an actual...

Weird utf8 conversion problem in php

So I'm working on a project that is taking data from a file, in the file some lines require utf8 symbols but are encoded oddly, they are \xC6 for example rather than being \Æ If I do as follows: $name = "\xC6ther"; $name = preg_replace('/x([a-fA-F0-9]{2})/', '&#$1;', $name); echo utf8_encode($name); It works fine. I get this: Æther ...

How to check if there are only spaces in string in PHP?

print_r(strlen(trim(' '))); the result is 9 I also tried preg_replace('/[\n\r\t\s]/', '', ' ') but the result is not zero. Please download my code and you will get the result http://blog.eood.cn/attachment.php?id=70 ...

PHP - UTF8 problem with German characters.

Hello, I'm at my wits end with this one, then I remember stack overflow. I have a site, http://bridgeserver3.co.uk/disklavier/de/ , the language is stored in a simple PHP file which looks like.. $translations["welcome_text_3"]="Zum Lieferumfang eines jeden Disklaviers gehšren bereits zahlreiche Lieder und das Angebot lŠsst sich jederz...