encoding

Using Delphi7 TClientDataSet: is it possible to have it save it's XML contents in an indented format

I am using Delphi7 ClientDataSet to read and write xml files for some of my data. Howerver, when I want to browse this outside the program (double clicking the xml in Windows Explorer) I get the 'An invalid character was found in text content. Error processing resource' - even although the data reads and writes fine from within Delphi. ...

User cp1252 as Javascript charset in IE

I am having a HTML site declared and encoded as UTF-8. My Javascript sources are encoded with cp1252. So i use this to set the encoding <script src="my_cp1252_encoded_file.js" charset="cp1252" ></script> This works in Mozilla but not in IE. Ideas? ...

The web page is ok with chorome, ie but mozilla again has problem

http://www.radikalgenc.com/bulten/ekim.htm this is a monthly newsletter. but it does not appear fine on mozilla, how can i fix this issue? ...

A url resource that is a dot (%2E)

I have a resource that is a . This means my url looks like this: http://myapp/index/. And i need to add query parameters so that it looks like this: http://myapp/index/.?type=xml I use Freemarker for the presentation of my resources and made a percent-encoding hack for this case: <#if key?matches("\\.")> <li><a href="${contextPath}/inde...

Decoding if it's not unicode

I want my function to take an argument that could be an unicode object or a utf-8 encoded string. Inside my function, I want to convert the argument to unicode. I have something like this: def myfunction(text): if not isinstance(text, unicode): text = unicode(text, 'utf-8') ... Is it possible to avoid the use of isins...

Value of the name of my radio button is getting encoded?

I have an rb named RB but when i request it in the action i noticed that it is getting encoded to something like _ctl100_RB. How can i prevent th is or encode to get the right value? What I would like to happen If Request("RB") = "opt1" then WHat is actually happening If Request("_ctl100_RB") ...

What's the best way to compress or encode a list of numbers into a single alphanumeric string?

What's the best way to compress or encode a list of numbers of arbitrary length and sizes into a single alphanumeric string? The goal is to be able to convert something like 1,5,8,3,20,212,42 into something like a8D1jN to be used in a URL, and then back to 1,5,8,3,20,212,42. For the resulting string I'm fine with any number and any asc...

Size difference when reading UTF8 encoded file

I'm trying to read a UTF8 encoded file (.torrent). In the file there is a 'pieces' section. Directly following that is the length of the text that contains a sequence of SHA1 hashes. The file reports a length (say 130100) to read, but when reading I end up going passed EOF. I'm not sure why this is happening. The files are good (I've t...

Re-encoding a NSString returns null

So I have this piece of code : if ([receivedPage hasPrefix:[NSString stringWithUTF8String:"\xC3\xAF\xC2\xBB\xC2\xBF"]]) // UTF-8 BOM 'EF BB BF' as UTF-16 chars { //DebugLog(@"converting calls list to UTF8"); receivedPage = [[[NSString alloc] initWithData:[receivedPage dataUsingEncoding:NSISOLatin1StringEncoding] enco...

How to make iconv ignore the encoding errors?

Hi, I've a long text file with some invalidad encoded characters in UTF-16. So far, I've been trying to convert it using the following code: ic = Iconv.new( 'UTF-8//IGNORE', 'UTF-16' ) urf_8_str = ic.iconv( an_invalid_encoded_utf_16_string ) And I get an Iconv::InvalidCharacter exception. I'm using OS X 10.6 (since it seems that the...

What's the difference between UTF8/UTF16 and Base64 in terms of encoding

In. c# We can use below class to do encoding: System.Text.Encoding.UTF8 System.Text.Encoding.UTF16 System.Text.Encoding.ASCII Why there is no System.Text.Encoding.Base64? We can only use Convert.From(To)Base64String method, what's special of base64? Can I say base64 is the same encoding method as UTF8? or UTF8 is one of base64? ...

Wikipedia (MediaWiki) URI encoding scheme

Folks, Anybody knows how Wikipedia or MediaWiki in general, encode the URI according to the title? It's not normal URI encoding, " "s are replaced with "_"s and single quotations are not encoded and things like that. Any reference on that? Cheers Parsa ...

php problem with russian language

i get page in utf-8 with russian language using curl. if i echo text it show good. then i use such code $dom = new domDocument; /*** load the html into the object ***/ @$dom->loadHTML($html); /*** discard white space ***/ $dom->preserveWhiteSpace = false; /*** the table by its tag name ***...

silverlight/wpf webbrowser encoding

Hi, i was looking for a long time to get a solution for polish charset in wpf webbrowser. After few hours of playing i made a solution, maybe someone else will need it also so i share. private string EncodeUnicode(string strText) { string txtUnicode = ""; foreach (char value in strText) { txtUnico...

Encoding error in Python with Chinese characters

I'm a beginner having trouble decoding several dozen CSV file with numbers + (Simplified) Chinese characters to UTF-8 in Python 2.7. I do not know the encoding of the input files so I have tried all the possible encodings I am aware of -- GB18030, UTF-7, UTF-8, UTF-16 & UTF-32 (LE & BE). Also, for good measure, GBK and GB3212, though th...

Why is PHP's utf8_encode breaking my utf-8 string?

I'm doing a kind of roundabout experiment thing where I'm pulling data from tables in a remote page to turn it into an ICS so that I can find out when this sports team is playing (because I can't find anywhere that the information is more readily available than in this table), but that's just to give you some context. I pull this data u...

C# char/byte encoding equality

I have some code to dump strings to stdout to check their encoding, it looks like this: private void DumpString(string s) { System.Console.Write("{0}: ", s); foreach (byte b in s) { System.Console.Write("{0}({1}) ", (char)b, b.ToString("x2")); } System.Console.Writ...

php encoded post param values

Was experimenting with some basic http post stuff with php and ran into this problem. 1.php: <head> <script src="/scripts/jquery.js"></script> </head> <body> <script> function hw(){ $.ajax({ type: 'POST', url: '/2.php', data: 'param=a+b+c', success: fu...

Python to javascript communication

OK so im using websockets to let javascript talk to python and that works very well BUT the data i need to send often has several parts like an array, (username,time,text) but how could i send it ? I originally though to encode each one in base64 or urlencode then use a character like | which those encoding methods will never use and the...

C# mvc2 encode url

i'm trying to encode an url with the code below; var encodedUrl = HttpUtility.UrlEncode("http://www.example.com"); var decodedUrl = HttpUtility.UrlDecode("http%3A%2F%2Fwww%2Eexample%2Ecom%2F"); I'm working with the google webmaster tools api and this api expects an URL as shown in the decodedUrl variable above. Every single character ...