encoding

Why should I use a human readable file format?

Why should I use a human readable file format in preference to a binary one? Is there ever a situation when this isn't the case? EDIT: I did have this as an explanation when initially posting the question, but it's not so relevant now: When answering this question I wanted to refer the asker to a standard SO answer on why using a human...

IMAP folder path encoding (IMAP UTF-7) for .NET?

The IMAP specification (RFC 2060, 5.1.3. Mailbox International Naming Convention) describes how to handle non-ASCII characters in folder names. It defines a modified UTF-7 encoding: By convention, international mailbox names are specified using a modified version of the UTF-7 encoding described in [UTF-7]. The purpose of thes...

Web service reponse encoding issue

Hello everyone, I am developing a Web Services based on ASP.Net asmx web service. The server end will response byte[] to client encoded in UTF-8, and client to convert the byte[] to string. My confusion is, the England pound character at server side (I dump just before the Http response is wrote, and the character at server side is cor...

Java - Convert String to valid URI object

I am trying to get a java.net.URI object from a String. The string has some characters which will need to be replaced by their percentage escape sequences. But when I use URLEncoder to encode the String with UTF-8 encoding, even the / are replaced with their escape sequences. How can I get a valid encoded URL from a String object? http...

base64 and UTF-8 encoding issue

Hello everyone, I am writing a simple web method which returns byte[], and the byte[] is encoded by UTF-8. I have investigated related WSDL and soap message, seems the underlying web services stack will use base64 encoding? For various reasons, I can not use or re-encode my return byte[] from UTF-8 to base64. Any ideas to modify the ba...

Why does text from Assembly.GetManifestResourceStream() start with three junk characters?

I have a SQL file added to my VS.NET 2008 project as an embedded resource. Whenever I use the following code to read the file's content, the string returned always starts with three junk characters and then the text I expect. I assume this has something to do with the Encoding.Default I am using, but that is just a guess. Why does this t...

What is the best way to download image data from ASP.NET to iphone?

I am building an iphone app that will require downloading an image from an ASP.NET web application (either as part of an XML document that is formatted according to the property list schema or by itself) into an (NSData *) object. What encoder should I use on the server side to generate compatible XML for the iphone? Is it as simple as...

c# Detect xml encoding from Byte Array?

Well i have a byte array, and i know its a xml serilized object in the byte array is there any way to get the encoding from it? Im not going to deserilize it but im saving it in a xml field on a sql server... so i need to convert it to a string? ...

Javascript encoding question

We have an external .js file that we want to include in a number of different pages. The file contains code for sorting a table on the client-side, and uses the ▲ and ▼ characters in the script to indicate which column is sorted and in which direction. The script was originally written for an ASP.Net page to offload some sorting work f...

Finding files ISO-8859-1 encoded?

I have a bunch of files with a mixtures of encodings mainly ISO-8859-1 and UTF-8. I would like to make all files UTF-8, but when trying to batch encode this files using iconv some problems arise. (Files cuts by half, etc.) I supposse the reason is that iconv requires to know the 'from' encoding, so if the command looks like this iconv...

Which video and audio format/codec should I use?

Environment: Windows XP/Vista, VS2008, C#/.NET 2.0, VideoGrabber. Hi All, I'm writing an app which captures cameras input and encodes them into a movie file (including sound). My client suggests I encode the movie using the DivX codec. But it's not installed by default and it's not redistributable: Users would have to download, instal...

Streamreader and foreign characters

Which encoding should I use to read æ,Ø,å,ä,ö,ü etc? ...

URL-encoded slash in URL

My Map is: routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with params new { controller = "Home", action = "Index", id = "" } // Param defaults ); If I use the URL http://localhost:5000/Home/About/100%2f200 there is no matching...

C# Help reading foreign characters using StreamReader

I'm using the code below to read a text file that contains foreign characters, the file is encoded ANSI and looks fine in notepad. The code below doesn't work, when the file values are read and shown in the datagrid the characters appear as squares, could there be another problem elsewhere? StreamReader reader = new StreamReader(inp...

How can encode a query string so that it is the value of another query string in javascript?

I have a javascript function which passes as a query string value another query string. In other words, I want the query string to be: http://www.somesite.com/?somequery=%3fkey%3dvalue1%2520%26%2520key2%3value3 However, if I redirect like this: var url = 'http://www.somesite.com/?somequery='; url += escape(?key=value1&key2=value2); ...

To encode vb script

How to encode vb script so that others cant see the code inside ...

How many characters are there in a GUID?

Using ASCII encoding, how many characters are there in a GUID? I'm interested in the Microsoft style, which includes the curly brackets and dashes. ...

C# URLDecode turns %5C into \\\\ instead of \

I have a web service method that takes a network login (string) as a parameter. The login is URL Encoded from JavaScript so the DOMAIN\USERNAME is encoded into DOMAIN%5CUSERNAME. When I use the HttpUtility.URLDecode on the string, it escapes the backslash and gives me DOMAIN\\USERNAME. I'm attempting to pass this into a profile provid...

When encoding HTML input for security, how do I avoid encoding international characters like Ñ or ñ?

I have a textarea in an ASP.NET MVC Application where the user can type some text. When I show the text to the user, I use Html.Encode to prevent malicious input. The problem is that the user can type in Spanish and maybe he types año and the Encode transforms this into a&#241o. How Can I prevent this? EDIT: In the generated HTML, I see...

Obscure / encrypt an order number as another number: symmetrical, "random" appearance?

Client has an simple increasing order number (1, 2, 3...). He wants end-users to receive an 8- or 9- digit (digits only -- no characters) "random" number. Obviously, this "random" number actually has to be unique and reversible (it's really an encryption of the actualOrderNumber). My first thought was to just shuffle some bits. When I ...