encoding

Detect the URI encoding automatically in Tomcat

I have an instance of Apache Tomcat 6.x running, and I want it to interpret the character set of incoming URLs a little more intelligent than the default behavior. In particular, I want to achieve the following mapping: So%DFe => Soße So%C3%9Fe => Soße So%DF%C3%9F => (error) The bevavior I want could be described as "try to decode the...

Text encoding in HTML text fields

I have a site up that has a form on it. The form POSTs to a php script which then inserts the data into my database. The page has a charset=UTF-8 attribute in the <meta> tag, and the database is setup to use UTF-8. However, when I copy and paste characters from MS Word into the field, the output is messed up. For example, the quotes in...

PHP File unreadable after being downloaded

Hi I have a script that creates a file and stores it on the server. The file is encoded in UTF-8 and is a kind of xml file for the cmap software. If i open the file directly from the server then there is no problem and the file can be read. I am forcing a download of this file when a user goes to a specific url. After such a download...

Saving CSV in cocoa

Hello, I need to make a cvs file in cocoa. To see how to set it up I created one in Numbers and opened it with text edit it looked like this: Results,,,,,,,,,,,, ,,,,,,,,,,,, A,10,,,,,,,,,,, B,10,,,,,,,,,,, C,10,,,,,,,,,,, D,10,,,,,,,,,,, E,10,,,,,,,,,,, So to replicate this in cocoa I used: NSString *CVSData = [NSString stringWithF...

How to encode data in datagridview column?

Is possible to encode the data that a column in a datagridview? The data is of type string. ...

Encode mail as quoted-printable before sending in Rails

I saw this question and couldn't make use of it: http://stackoverflow.com/questions/1034135/ruby-email-encoding-and-quoted-printable-content I'd like to send out email as quoted-printable, but it's going out as unencoded text/html. Any help? class UserMailer < ActionMailer::Base def welcome_mail(user) recipients user.emai...

utf8 and encoding

I have a sting in unicode is "hao123--我的上网主页", while in utf8 in C++ string is "hao123锛嶏紞鎴戠殑涓婄綉涓婚〉", but I should write it to a file in this format "hao123\uFF0D\uFF0D\u6211\u7684\u4E0A\u7F51\u4E3B\u9875", how can I do it. I know little about this encoding. Can anyone help? thanks! ...

How to workaround Python "WindowsError messages are not properly encoded" problem?

It's a trouble when Python raised a WindowsError, the encoding of message of the exception is always os-native-encoded. For example: import os os.remove('does_not_exist.file') Well, here we get an exception: Traceback (most recent call last): File "<stdin>", line 1, in <module> WindowsError: [Error 2] 系統找不到指定的檔案。: 'does_not_exist....

PHP - UTF-16 to UTF-8(hex) conversion

Is it possible to convert UTF-16 U+610F style character to UTF-8 (hex) E6848F using PHP ? UTF-8 character is '意' ...

determing server response encoding

not java specific, but when I say OutputStream os = sock.getOutputStream(); is there a way to determine stream's encoding charset? or do I have to know encoding charset ahead of time to properly read it? This is for arbitrary socket connection. ...

How to encode a URL for passing it as a GET parameter

I load a JavaScript file which takes current page's URL as a parameter. Here is the code I use: document.write(unescape('%3Cscript src=\"' + _vis_opt_protocol + 'domain.com/js.php&a='+account_id+'&url='+encodeURIComponent(document.URL)+'&random='+Math.random()+'\" type=\"text/javascript\"%3E%3C/script%3E')); I thought encodeURICompone...

PHP - stop character encoding auto-convertion

In html source \xE6\x82\xA0 result is "\xE6\x82\xA0" but in php <?php echo "\xE6\x82\xA0"; ?> result is "悠" (character for \xE6\x82\xA0 ) what can be done to make php echo \xE6\x82\xA0? ...

Encoding MySQL text fields into UTF-8 text files - problems with special characters

I'm writing a php script to export MySQL database rows into a .txt file formatted for Adobe InDesign's internal markup. Exports work, but when I encounter special characters like é or umlauts, I get weird symbols (eg Chloë Hanslip instead of Chloë Hanslip). Rather than run a search and replace for every possible weird character, I need...

c# -> javascript, Json decoding misses property

Hi all, I have a c# object (below) that I'm trying to send to my javascript. My problem is, that while I can iterate over the items in the list, I can't get to the string-property ('Period'). Referencing the object in JS shows no property at all. After Json-encoding in c#, I can still see the property just before returning it to calle...

Which encoding (code page) is used for file names in ZIP archive under Mac OS x 10.6

I have a zip library SharpZipLib which intended to work with ZIP archives using C#. It has parameter ICSharpCode.SharpZipLib.Zip.ZipConstants.DefaultCodePage which specifies encoding of file names in zip archive. I know that in Windows and in OSX different encodings are used to store file names. 1) Which encodings (code pages) are used ...

C++ unicode UTF-16 encoding

Hi all, I have a wide char string is L"hao123--我的上网主页", and it must be encoded to "hao123--\u6211\u7684\u4E0A\u7F51\u4E3B\u9875". I was told that the encoded string is a special “%uNNNN” format for encoding Unicode UTF-16 code points. In this website(http://rishida.net/tools/conversion/), it tell me it's JavaScript escapes. Bu...

JQuery ajax encoding problem on IE

im using ajax call on a comment form for a greek site. The encoding works fine for Firefox but not in IE. $(document).ready(function() { $.ajaxSetup({ scriptCharset: "utf-8" , contentType: "application/json; charset=utf-8"}); $('#submitAjax').click(function() { var name = $("#name").val(); var email = $("#email").val(); var comm...

Is there a way to store Unicode Text in an Oracle Database configured as 'US7ASCII'

We've recently hit a snag where a trademark symbol is being copied from one Oracle database to another, but have had it come across as a '?'. We've tracked the issue to the destination database being configured with a character set of 'US7ASCII'. Unfortunately, rebuilding the database to address this is not something we can do at the p...

Is there a way to set the encoding for all files read and written by python

I have a script in python that needs to read iso-8859-1 files and also write in that encoding. Now I am running the script in an environment with all locales set at utf-8. Is there a way to define in my python scripts that all file acces have to use the iso-8859-1 encoding? ...

how to know which special character is there in a file?

My app needs to process text files during a batch process. Occassionally I receive a file with some special character at the end of the file. I am not sure what that special character is. Is there anyway I can find what that character is so that I can tell the other team which is producing that file. I have used mozilla's library to gue...