encoding

What encoding/code page is cmd.exe using

When I open cmd.exe in Windows, what encoding is it using? How can I check which encoding it is currently using? Does it depend on my regional setting or are there any environment variables to check? What happens when you type a file with a certain encoding? Sometimes I get garbled characters (incorrect encoding used) and sometimes it k...

How to replace Microsoft-encoded quotes in PHP

I need to replace Microsoft Word version of single and double quotations marks (“ ” ‘ ’) with regular quotes (' and ") due to an encoding issue in my application. I do not need them to be HTML entities and I cannot change my database schema. I have two options: to use either a regular expression or an associated array. Is there a bett...

What's need to be done in order to prevent foreign language user input to become gibberish?

I'm planning to write an application that, mainly, take inputs from the user and display them. What can I do in order to support input in many languages? Is there an easy way to support all native languages (windows supported)? What's need to be done in order to prevent right-to-left languages to appear backwards? (I saw it happen whe...

Injection Attacks against .NET DataView RowFilter

So I'm writing a handler that filters a cached DataTable based on the AppRelativeCurrentExecutionFilePath using the DataView RowFilter property. What's the best way to encode the input to prevent an injection attack? Is the following sufficient? Is there a better/more-elegant way? dataView.RowFilter = String.Format("Name LIKE '{0}%'"...

What is the best encoding for buildin a multilingual java based web application, and why?

Just curious about the the encoding of files (the actual rendered pages). What encoding should they be in to support widest possible language space in a typical jsp type web application. ...

Python standard library to POST multipart/form-data encoded data

hello, I would like to POST multipart/form-data encoded data. I have found an external module that does it: http://atlee.ca/software/poster/index.html however I would rather avoid this dependency. Is there a way to do this using the standard libraries? thanks ...

Problem encoding UTF8 data from Rails app to Mysql

I'm having trouble saving UTF8 data in a form and having it correctly saved in mysql. In particular, via my ruby application I'm post a form that includes the following: Gerhard Tröster Which in my terminal I see is being updated in the database as: UPDATE `xxxx` SET `updated_at` = '2009-08-13 14:22:33', `description` = '<p><s...

How to detect if a string is encoded with escape() or encodeURIComponent()

Hi guys, I have a web service that receives data from various clients. Some of them sends the data encoded using escape(), while the others instead use encodeURIComponent(). Is there a way to detect the encoding used to escape the data? ...

characters changed in a Curl request.

When I look at the XML data feed i get with the below code, special characters are correct in the XML code. However when Curl returns the data, characters like "ó" and "ä" are converted into resp. "ó" and "ä". This conversion happens to all special characters, these 2 are just an example. $myvar = curl_init(); $myURL = "http://someurl...

MySQL - insert japanese from PHP - Encoding Troubles! [SOLVED]

Hello! I'm trying to insert some japanese words in a mysql table! If I insert 'こんにちは' using phpMyAdmin, the word is displayed fine from phpMyAdmin. But if I try to insert it through php, as follow: mysql_connect($Host, $User, $Password); mysql_select_db($Database); $qry = "INSERT INTO table VALUES (0 , 'こんにちは')"; echo mysql_query($qr...

Chinese characters in mailto subject line of email

I'm looking to add some Chinese characters in a mailto: email link. I've tried <a href="mailto:[email protected]?subject=调查 / Inquiry">Email</a> but when I click on the link the Outlook subject line shows: 调查亨德森 / Inquiry I've also tried <a href="mailto:[email protected]?subject=&#35843;&#26597; / Inquiry">Email</a>...

Java Text File Encoding

I have a text file and it can be ANSI (with ISO-8859-2 charset), UTF-8, UCS-2 Big or Little Endian. Is there any way to detect the encoding of the file to read it properly? Or is it possible to read a file without giving the encoding? (and it reads the file as it is) (There are several program that can detect and convert encoding/form...

What would make Ant execute 'javac' in Eclipse with UTF-8 instead of my system default Cp1252?

The last week I've been trying to figure out why some stream decoding my newly adopted application is doing was giving me some major encoding problems. Finally I figured out that the problem was that the JARs/WAR being built with Ant and deployed to the server were being compiled with the javac task using the encoding UTF-8 instead of th...

How to Redirect to a url containing an anchor (#)?

I need to take standard incoming urls and rewrite redirect them to target specific anchors on a single page (incoming html page name becomes the anchor name). E.g., the rule would be like this: RewriteRule ^files/([a-zA-Z0-9\-_]+)\.html$ /test.html#$1 [R] So this url: http://foo.com/files/bar.html ...would become: http://foo.com/...

Encode ALL urls in Drupal?

Is there any way to encode ALL urls in Drupal? I.e. Instead of something like this: - www.mysite.com/node/add/blog Will turn the URL into: - www.mysite.com/9595kfjfj4fmvmvk4m4mfmkfk44kfk ? ...

utf8 problem with swedish characters from command line

I have a script that gets a string from the database, splits it into words and writes the words to the database. It works perfectly when i call the script via http (using apache web server). It also works to run it from a windows command line. However, when i try to run it from the command line (shell) in ubuntu all swedish chars ÅÄÖ is ...

Is there an easy way to create a C# .NET file dialog with encoding dialog box?

I'm trying to let the user select the file encoding when they load or save a file in C# and VS2008. Notepad's dialog boxes have an encoding drop down option at the bottom. There is a way to do it as described in here: http://www.codeproject.com/KB/cs/getsavefilename.aspx. However, I'm wondering if there is any easier way to do this. Wi...

Log4j encoding problem

I configured log4j SMTPAppender to send emails to me on errors. It works, but I have problem with non ASCII data. Configuration uses HTMLLayout and their documentation states: Appenders using this layout should have their encoding set to UTF-8 or UTF-16, otherwise events containing non ASCII characters could result in corrupted log fil...

httprequest encoding mismatch

I'm using a Google Gears Worker to submt a POST httprequest (using var request = google.gears.factory.create('beta.httprequest'); ) with a parameter containing the string "bford%20%24%23%26!%3F%40%20%E5%BE%B3%E5%8A%9B%E5%9F%BA%E5%BD%A6" but the Django HttpRequest is receiving it as "bford $#&!?@ å¾³å\u008a\u009bå\u009fºå½¦" How do I...

Encoding.Default is not the same as no encoding in File.ReadAllText?

(Sorry if this is a dupe) I've just spent a long time trying to read a text file correctly. Having started with File.ReadAllText(path) and getting screwed-up characters, I tried several variants of File.ReadAlltext(path, Encoding) after which I got bogged down trying to analyse my input files to work out which byte was the problem, etc...