character-encoding

Rails + Ruby 1.9 "invalid byte squence in US-ASCII"

After upgrading to ruby 1.9 we began to notice pages failing to render from the rails template renderer when a user used a non-ASCII character. Specifically "é". I was able to resolve this issue on one of our staging servers, but I have not been able to reproduce the fix on our production server. The fix that seemed to work the first ti...

Can I set the default string encoding on Ruby 1.9?

This might sound minor, but it's been driving me nuts. Since releasing an application to production last Friday on Ruby 1.9, I've been having lots of minor exceptions related to character encodings. Almost all of it is some variation on: Encoding::CompatibilityError: incompatible character encodings: ASCII-8BIT and UTF-8 We have an ...

How can i remove umlauts from XML?

i have tried to remove umlaults from XML.i have also used some code like this but still it's not working so please help me in my task. NSString *something = [self base64StringFromData:CDATABlock length:[CDATABlock length]]; NSData *pageData=[something dataUsingEncoding:NSUTF8StringEncoding]; NSString *webpage = [NSString stringWith...

How to parse encoding data from the rss feed?

i am parsing rss feed.But i cantable to parse encoding data from thee rss feed.How to parse encoding data from the rss feed? ...

Converting Multibyte characters to UTF-8

Hi All, My application has to write data to an XML file which will be read by a swf file. The swf expects the data in the XML to be in UTF-8 encoding. I have to convert some Multibyte characters in my app(Chinese simplified, Japanese, Korean etc..) to UTF-8. Are there any API calls which could allow me to do this?I would pre...

How to write ASCII extended characters(which has ascii code > 127) to XML file using java?

I read texts from different sources which can have characters from different languages/extended characters like € ƒ „ … † ® ©. And then I am supposed to write to an XML file, I am using PrinterWriter in java to write to an XML file whatever string I read. So for these types of extended characters which has ascii greater than 127 gives il...

How to use NULL character with NSString

In php i can call base64_encode("\x00". $username. "\x00". $password) and the "\x00" represents a NULL character. I have a function that converts NSData to base64 encoded NSString created by DaveDribin. How do I create data from a string that has null characters? This doesnt seem to work... NSData * authCode = [[NSString stringWithFo...

Change encoding from UTF-8 to ISO-8859-2 in Javascript

I would like to change string encoding from UTF-8 to ISO-8859-2 in Javascript. How can I do it? I need it because I've designed a widget. User just copies < script > tag from my site and puts it on his. This script creates div and puts into div widget contents with text. If target website is in UTF-8 encoding - it works fine. But when ...

Twitter sharing problems with umlauts ä & ö

I'm having trouble sharing messages containing scandinavian ä & ö to twitter through a share-button on my site. If I use UTF8-codes above %7F, i just bump into an "Invalid Unicode value in one or more parameters" error. An example: http://twitter.com/home/?status=%40user+blah%26%E4 I've tried a bunch of different encodings, but none se...

Does this program show the four card suits (♠♣♥♦) on all standard-ish systems?

The following shows ♠♣♥♦ on windows xp, will it for all systems?? #include <stdio.h> int main(int argc, char *argv[]) { for (int i = 3; i <= 6; ++i) printf("%c", (char)i); getchar(); return 0; } ...

How I print UTF-8 characters C++?

How I print these UTF-8 characters in C++? ...

Python, Source-Code Encoding Problem

I'm using Notepad++ editor on windows with format set to ASCII, I've read "PEP 263: Source Code Encodings" and amended my code accordingly (I think), but there are characters still printing in hex... #!/usr/bin/python # -*- coding: UTF-8 -*- import os, sys a_munge = [ "A", "4", "/\\", "\@", "/-\\", "^", "aye", "?" ] b_munge = [ "B", "...

C++ encoding macro

Is there a macro that tells you what encoding C++ is using for its wchar_t type? I am currently stuck to GNU and clang. I am guessing UTF32 because my wchar_t has a size of 4 bytes. Although it could be UTF-16, it also uses 4 bytes for some code-points. But then there is still the problem of UCS-4 or UTF-32LE or UTF-32BE. Any help/expe...

size of char type in c#

Just wondering why do we have 'char' type of size=2Bytes in c#(.net) unlike 1Byte in other programming languages? ...

TM symbol not displaying correctly on redirected URL

I have a url that redirects to a page on my main site. For some reason, when I access through the rewritten URL, a TM symbol is showing up as â¢, but when I access through the main site, it shows up correctly. The urls are http://waterlessmilkwarmer.com/ and http://www.medelabreastfeedingus.com/milk-warmer so you can see what's happenin...

Writing a base64 string to a file without carriage returns

Will I run into problems if I write a base64 string into a file without breaking it up using carriage returns? Is there a length where I'll run into difficulties writing and reading a big string in one go? Right now the size of the strings I'm storing are about 100 characters but they can get into the 10,000+ range - will that be a p...

Character encoding changes after window.open()

The site from where I'm calling the window.open() function is in UTF-8, using the <meta> tag, everything works well, but once I call the function and open another window with the same tag, the new window shows weird characters even thought in page info it shows that the encoding stays the same (UTF-8). This is the same problem as mine: ...

javascript ampersand (&) in return data will not show as value

Hi! I have this bit of code: ... var aData = request.responseXML.getElementsByTagName('data')[0]; var sDescription = aData.getElementsByTagName('description')[0].firstChild.data; alert(escape(sDescription)); document.getElementById('tempLabourLineDescription').value = sDescription; ... sDescription is outputting: SUPPORT ASSY-FUEL ...

PHP encoding with DOMDocument

<tag> Алекс М </tag> When I try to get the content of the following code using DOMDocument functions, it returns something like: ÐÐ»ÐµÐºÑ Ðœ I've tried setting DOMDocument encoding to different values (UTF-8, ISO-8859-1), using mb_convert_encoding, iconv and utf8_encode but without success. How can I get "Алекс М" instead of "ÐлÐ...

Define Default Charset for htmlentities()

I was wondering if there were any way to define the default encoding for htmlentities(). I have a big project going that uses htmlentities calls all over the place, and was wondering if there was a simple way to set it from ISO-8859-1 to UTF-8 as the default character encoding, using something simple like init_set. Or possibly with a sep...