encoding

c# Registry System.Byte[] to string

I am currently writing a program that will read part of the windows system registry however some of the values of these keys are of type System.Byte[] when i try and decode these values I can produce a string that has some readable characters that makes but mostly the string is jiberish. I have tried several encoding types but none seem ...

Wrong encoding of text, in Django?

"query" = джазовыми For some reason...when I display it via: {{ query|safe }} I get this: %u0434%u0436%u0430%u0437%u043E%u0432%u044B%u043C%u0438 ...

Why does it print funny characters? unicode problem?

The user entered the word éclair into the search box. Showing results 1 - 10 of about 140 for �air. Why does it show the weird question mark? I'm using Django to display it: Showing results 1 - 10 of about 140 for {{query|safe}} ...

How do i use Django and UTF-8 content-type for template?

When I do: return render_to_response() in Django. How do I set the content-type to UTF-8? So that everything displayed is UTF-8? ...

string filter: detect non-ASCII signs

Hi, I am creating an application which will send the input string to mobile device. Some devices have problems with encoding special characters so I would like to create a filter which doesn't allow the user on PC to enter special characters. The application is written in C# (.NET 3.5) and I would like to attach a method to key press e...

Why is this displaying weird characters on the console?

Take this text for example: the three umlauts are ä, ö, and ü.. Let's assume they are in a text file, which I'm reading like this: data = File.read("umlauts.txt") Now, if I try to output them, I get this: the three umlauts are Σ, ÷, and ⁿ. If I write it to a file, they get outputted correctly. How can I make them show up properly...

Why does Django admin try to encode strings into ASCII rather than Unicode? Or is this error something different than it looks like?

I've got the following error: TemplateSyntaxError at /admin/results_cop/copsegmentresult/ Caught an exception while rendering: ('ascii', 'ISU European Figure Skating Championships 2009: Senior Ladies Ladies: Short Program - 2. Susanna P\xc3\x96YKI\xc3\x96', 98, 99, 'ordinal not in range(128)') The fragment of the s...

If I have this string in Python, how do I decode it?

s = 'Tara%2520Stiles%2520Living' How do I turn it into: Tara Stiles Living ...

UTF-8 Encoding in java, retrieving data from website

I'm trying to get data from website which is encoded in UTF-8 and insert them into the database (MYSQL). Database is also encoded in UTF-8. This is the method I use to download data from specific site. public String download(String url) throws java.io.IOException { java.io.InputStream s = null; java.io.InputStreamRe...

Python Encoding Issue

I am really lost in all the encoding/decoding issues with Python. Having read quite few docs about how to handle incoming perfectly, i still have issues with few languages, like Korean. Anyhow, here is the what i am doing. korean_text = korean_text.encode('utf-8', 'ignore') korean_text = unicode(korean_text, 'utf-8') I save the above ...

How do you programmatically change the WCF message encoding for NetTcp?

I have a custom intranet application that has no interoperability requirements. We programatically construct a NetTcp channel in duplex mode for passing messages. We wanted to change the message encoding but haven't been able to figure out how to make that happen. The approach we have taken (unsuccessfully) has been to extend the NetT...

Is it possible to get Character after "Shift" has been pressed, without pressing shift?

Is it possible to get the Character if "Shift" was Pressed, ie. if i press "1" I get the "1" character, but if I hold down "Shift" it becomes "!" - all without the quotes of course. I want to to something like this programatically. There was a method where you could just add to the ASCII code however this option is not suitable as it won...

Cannot decode/encode in UTF-8.

I have a text-box which allows users to enter a word. The user enters: über In the backend, I get the word like this: def form_process(request): word = request.GET.get('the_word') word = word.encode('utf-8') #word = word.decode('utf-8') print word For some reason, I cannot decode or encode this!! It gives me the err...

Iphone: encoding problem

Hi.. I am opening a text file containing language data and reading it into a dictionary. The code retrieves all the data, but I can`t get the encoding right. Characters in the text file like for instance "Â" gets translated to "√Ç" instead of "å". I`m starting to get really annoyed by this problem, and i really appreciate if someone c...

Guid to Base34 encoder/decoder

Does anyone have a nice code snippet for a Guid to Base34 encoder/decoder, I've googled around for it previously and never really found any good sources. ...

Windows-1252 to UTF-8 encoding

I've copied certain files from a Windows machine to a Linux machine. So all the windows encoded(windows-1252) files need to be converted to UTF-8. The files which are already in UTF-8 should not be changed. I'm planning to use the "recode" utility for that. How can I specify that the "recode" utility should only convert windows-1252 enco...

powershell character problem

Hi, I am running the following command. ([xml](new-object net.webclient).DownloadString( "http://blogs.msdn.com/powershell/rss.aspx" )).rss.channel.item | format-table title,link The answer shows me that one rss items has the text "You Don’t Have to Be An Administrator to Run Remote PowerShell Commands" So, the question is; why the...

How can I send a big HTML block in JSON

I need to send a big block of HTML in a Json object like this: JsonResult jsn = Json(new Dictionary<string, object> { { "success", true }, { "lastPID", posts[0].ID }, { "content", "" } }); return jsn; For some reason I get this error when I put that html block into the content var...

Strange email format attachement encodnig

Here is sample of email attachemt, it opens OK in Outlook express, but i really don't know how to decode this to useful data (it's .csv file) with php? begin 664 AGI_NAV_PERF_20100107.csv M4D507T1!5$4[25-)3CM&54Y$4U].04U%.TY!5E]015)?4TA!4D4[4D5455). M7S%$.U)%5%523E]95$0[4D5455).7S%9.U)%5%523E\S63M354)30U))4%1) M3TY?1D5%.U)%1$5-4%1)3TY?1...

Decoding extended characters in XML

I know this is probably simple and has probably been asked before, but I'm having trouble coming up with a solution. I am parsing some RSS feeds which include HTML as CDATA blocks. One example is here: http://g.msn.com/1ewenus50/news2 The feed changes a lot, but there are almost always some extended characters in it. For example if I m...