encoding

Character encoding problem - PHP output, read by .NET, via HttpWebRequest

I have a PHP script (running on a Linux server) that ouputs the names of some files on the server. It outputs these file names in a simple text-only format. This output is read from a VB.NET program by using HttpWebRequest, HttpWebResponse, and a StreamReader. The problem is that some of the file names being output contain... unusual c...

Simple properties to string conversion in Java

Using Java, I need to encode a Map<String, String> of name value pairs to store into a String, and be able to decode it again. These will be stored in a database column, and will probably usually be short and simple, so the common case should produce a simple nice looking line, but shouldn't corrupt the data, even if it contains unexpe...

StreamReader problem - Unknown file encoding (western iso 88591)

When reading data from the Input file I noticed that the ¥ symbom was not being read by the StreamReader. Mozilla Firefox showed the input file type as Western (ISO-8859-1). After playing around with the encoding parameters I found it worked successfully for the following values: System.Text.Encoding.GetEncoding(1252) // (western iso 8...

How can I convert messages in an mbox file to UTF-8?

Hello, I am trying to modify the below program to ensure each msg is converted to utf-8 using Encode::decode(), but I am unsure of how and where to place this to make it work. #!/usr/bin/perl use warnings; use strict; use Mail::Box::Manager; open (MYFILE, '>>data.txt'); binmode(MYFILE, ':encoding(UTF-8)'); my $file = shift || $ENV{...

Streaming files and character sets problem

I have made some code which exports some details of a journal article to a reference manager called Endnote The format of which is a list of items like below (an author): %A Schortgen Frédérique Unfortunately, I am having some encoding problems somewhere, as when endnote opens the file, this is what it makes of the above author: ...

How Can I Best Guess the Encoding when the BOM (Byte Order Mark) is Missing?

My program has to read files that use various encodings. They may be ANSI, UTF-8 or UTF-16 (big or little endian). When the BOM (Byte Order Mark) is there, I have no problem. I know if the file is UTF-8 or UTF-16 BE or LE. I wanted to assume when there was no BOM that the file was ANSI. But I have found that the files I am dealing wit...

How to write out a text file in C# with a code page other than utf-8?

I want to write out a text file. Instead of the default UTF-8, I want to write it encoded as ISO-8859-1 which is code page 28591. I have no idea how to do this... I'm writing out my file with the following very simple code: using (StreamWriter sw = File.CreateText(myfilename)) { sw.WriteLine("my text..."); sw.Close(); } ? ...

Convert utf8-characters to iso-88591 and back in PHP

Hi all. Some of my script are using different encoding, and when I try to combine them, this has becom an issue. But I can't change the encoding they use, instead I want to change the encodig of the result from script A, and use it as parameter in script B. So: is there any simple way to change a string from UTF-8 to ISO-88591 in PHP...

Character encoding JSP -displayed wrong in JSP but not in URL: "á » á é » é"

I have this Web Application in JSP running on JBoss Application Server. I am using Servlets for friendly urls. I'm sending search parameters through my JSP's and Servlets. I am using a form with a text box, the Servlet The first Servlet uses request.getParameter() to get the text, and sends it to another Servlet with response.sendRedir...

Converting MBCS stream to UTF-8 and vice versa in C++

Hi, I'm using Visual C++ (VS2005) and compiling the project in Multibyte Character Set (MBCS). However, the program needs to communicate with a webapp (which is in utf-8) via XMLRPC. So I'm thinking maybe I can use MBCS internally and convert the strings to utf-8 before sending them to the xmlrpc module and converting them back to MBCS ...

Howto identify UTF-8 encoded strings

What's the best way to identify if a string (is or) might be UTF-8 encoded? The Win32 API IsTextUnicode isn't of much help here. Also, the string will not have an UTF-8 BOM, so that cannot be checked for. And, yes, I know that only characters above the ASCII range are encoded with more than 1 byte. ...

Handling a Unicode String in Delphi Versions <= 2007

Background: This question relates to versions of Delphi below 2009 (ie without Unicode support built in). I have a specification that requires me to transmit a Unicode encoded string over a TCP connection but I do not have Delphi 2009. Question Is there a single function or very small library (I don't need too much bulk) that I can use...

proper/best type for storing latitude and longitude

In a system level programming language like C, C++ or D, what is the best type/encoding for storing latitude and longitude? The options I see are: IEEE-754 FP as degrees or radians degrees or radians stored as a fixed point value in an 32 or 64 bit int mapping of an integer range to the degree range: -> deg = (360/2^32)*val degrees, m...

Trouble with encoding in emails

I have a little python script that pulls emails from a POP mail address and dumps them into a file (one file one email) Then a PHP script runs through the files and displays them. I am having an issue with ISO-8859-1 (Latin-1) encoded email Here's an example of the text i get: =?iso-8859-1?Q?G=EDsli_Karlsson?= and Sj=E1um hva=F0 =F3li...

Html.Encode() doesn't encode a space

In my asp.net-mvc website I have a field that usually has a string (from database) but can from time to time contain nothing. Because IE doesn't know how to handle the css "empty-cells" tag, empty table cells need to be filled with an &nbsp; I thought Html.Encode(" "); would fix this for me, but apparantly, it just returns " ". I c...

How to get ASCII value of string in C#

I want to get Ascii Value of string in C# My string will have value like "9quali52ty3" this ,so if I just convert it to integer I don't get ascii values of numbers that are in the string Can any one please help me with getting ascii values in C# ...

PHP/MySQL with encoding problems

I am having trouble with PHP regarding encoding. I have a JavaScript/jQuery HTML5 page interact with my PHP script using $.post. However, PHP is facing a weird problem, probably related to encoding. When I write htmlentities("í") I expect PHP to output &iacute;. However, instead it outputs &Atilde;&shy; At the beginning, I thought ...

Problem with encoding after in/out of a database

I'm doing a bookmarking-system. But when I insert the fetched title "Chapter 4. Examples for advanced use of VLC's stream output (transcoding, multiple streaming, etc...)", it looks perfectly good in the database, but when I print it out again on the display-page, it looks like this: Chapter�4.� Examples for advanced use of VLC's stre...

Python mailbox encoding errors

First, let me say that I'm a complete beginner at Python. I've never learned the language, I just thought "how hard can it be" when Google turned up nothing but Python snippets to solve my problem. :) I have a bunch of mailboxes in Maildir format (a backup from the mail server on my old web host), and I need to extract the emails from t...

String value that represents an email attachment, how to store to disk/db?

Ok it turns out this 3rd party component I am working with stores an email attachment in a property of string type (it is already decoded). How would I store this to file now? It has: filename, encodingtype and the string representation of the file. ...