encoding

problems reading CDATA section with special chars (ISO-8859-1 encoding)

I am trying to read a xml stream and load it into a collection. This works but Im having difficulties reading special chars. E.g. if my xml looks like this <?xml version="1.0" encoding="ISO-8859-1" ?> <persons> <person> <firstname> <![CDATA[ Sébastien ]]> </firstname> <lastname> <![CDATA[Ørvåk]]> </lastname> </person> </...

Get file encoding

How can I figure out with PHP what file encoding a file has? ...

How do I encode params for posting with curl from Rails?

Hi, I am using Pommo for my mailing list, unfortunatelly Pommo doesn't provide an HTTP API but provides and embedable subscription form I can put on my site. But posting using that form takes me out of my site and that is unacceptable for me. So I want to do the field validation in Rails and then use curl to post the values. The fields...

how to add encoding information to the response stream ?

hi i have following piece of code: public void ProcessRequest (HttpContext context) { context.Response.ContentType = "text/rtf; charset=UTF-8"; context.Response.Charset = "UTF-8"; context.Response.ContentEncoding = System.Text.Encoding.UTF8; context.Response.AddHeader("Content-disposition", "attachment;filename=lista_o...

URL's and plus signs

I am aware that a + in the query string of a URL represents a space. Is this also the case outside of the query string region? That is to say, does the following URL: http://a.com/a+b/c actually represent: http://a.com/a b/c (and thus need to be encoded if it should actually be a +), or does it in fact actually represent a+b/c ? Tha...

What is the default encoding of jvm?

Whether the default encoding for jvm is UTF-8 or some other? In jvm where it will be mentioned? ...

How do I show the pound sterling (£) sign in Java Swing?

Currently, I add a pound sterling () sign to the Java source and compile the resulting Swing component shows as the square (unsupported character) symbol. I suspect it's an encoding problem, the Java source file is encoded as cp1252 (Eclipse seems to default to this). What's the correct way of resolving this? ...

ISO-8859-1 to UTF8 in ASP.NET 2

We've got a page which posts data to our ASP.NET app in ISO-8859-1 <head> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> <title>`Sample Search Invoker`</title> </head> <body> <form name="advancedform" method="post" action="SearchResults.aspx"> <input class="field" name="SearchTextBox" type="text" /...

Difference in writing string vs. char array with System.IO.BinaryWriter

I’m writing text to a binary file in C# and see a difference in quantity written between writing a string and a character array. I’m using System.IO.BinaryWriter and watching BinaryWriter.BaseStream.Length as the writes occur. These are my results: using(BinaryWriter bw = new BinaryWriter(File.Open(“data.dat”), Encoding.ASCII)) { stri...

Why are HTML character entities necessary?

Why are HTML character entities necessary? What good are they? I don't see the point. ...

UTF chars retrieved with AJAX are not shown in Safari

Hi, I have problem rendering content retrieved via Ajax into my HTML page under Safari (v.4). The page is stored in UTF-8, Ajax response is also UTF-8 encoded. The loaded content is parsed and then different types of lists are populated with the parsed data. One of them is simple < select > element where the text of the option is set u...

reading in utf-8 file (javascript XMLHttpRequest) gives bad european characters

Hi there, can anyone help? I have small procedure to read in an UTF-8 file with javascript using XMLHttpRequest.. this file has european characters like miércoles sábado etc.. Notice the accents.. But when being read in .. the characters are all messed up.. I have checked the file and it is perfect.. it must be the procedure for readin...

Own encoding

How can i create my own encoding in ruby(1.9)? - for converting string while reading/writing from/for a file, i.e. generally for manipulating data in nonstandard encoded strings (http://en.wikipedia.org/wiki/Mazovia_encoding) ...

Help to review whether my XML validation code is efficient

Hello everyone, I am checking againtst whether a specific input string are valid (could be used as the value for an XML element) in XML UTF-8 encoding. My goal is to tell which string (from an input string array) is not valid according to XML UTF-8 encoding standard. Here is my code, my current implementation is straightforward -- asse...

Determine a string's encoding in C#

Hi, Is there any way to determine a string's encoding in C#? Say, I have a filename string, but I don't know if it is encoded in Unicode UTF-16 or the system-default encoding, how do I find out? Thanks, kreb ...

Using Tcl encoding command to convert from Traditional Chinese to Simplified Chinese

I support a website written in Tcl which displays data in Traditional Chinese (big5). We then have a Java servlet, using the translation code from mandarintools.com, to translate a page request into Simplified Chinese. The conversion as specified to the translation code is from UTF-8 to UTF-8S; Java is apparently correctly translating...

I have latin1 encoded data sitting in a UTF-8 mysql database, how do I fix this?

I have latin1 encoded data sitting in a UTF-8 mysql database, how do I fix this? There is no original data to go from unfortunately. I figured out this much as the only way I could display the data correctly was to set everything latin1 in PHP, HTML and MySQL. Once this is completed, I can change everything back to utf-8 in my html an...

Why can't RSS handle the Ampersand?

This is something I've been wondering for a while now. I'll occasionally come across an RSS feed that is broken, and blown to pieces all because line 23 say "Sanford & Sons." The most confusing thing is the fact that if you convert the & into &amp;, all is well, even though your alternative still contains the problem-char! Please somebo...

Encoding issue in Java

I have a CSV file that contains both ASCII & Unicode characters. say "ÅÔÉA". I am not sure abt the encoding format of this file, but when I open it in Notepad, it shows "ANSI" as its encoding standard. I fetch these contents of CSV in UTF-8 encoded format. fr = new InputStreamReader(new FileInputStream(fileName),"UTF-8"); but when I ...

Setting encoding, newline, linebreaks, end-of-line (EOL) in PHP

For example, when I create a new file: $message = "Hello!"; $fh = fopen(index.html, 'w'); fwrite($fh, $message); fclose($fh); How can I set it's encoding(utf-8 or shift-jis or euc-jp) and linebreaks(LF or CR+LF or CR) in PHP? ...