encoding

Test serialization encoding

What is the best way to verify/test that a text string is serialized to a byte array with a certain encoding? In my case, I want to verify that an XML structure is serialized to a byte array with the UTF-8 encoding which is of variable character length. As an example, my current ugly procedure is to inject a character known to require t...

Html entities inside asp.net page

Hi! Inside an asp.net page, shoul I use <html><title>My page's title from México</title></html> Or <html><title>My page's title from M&eacute;xico</title></html> Both examples have same output. Since asp.net encodes all my pages to utf-8 there is no need to use html entities, is that right? Thanks a lot. ...

Strange characters in PHP

This is driving me crazy. I have this one php file on a test server at work which does not work.. I kept deleting stuff from it till it became <? print 'Hello'; ?> it outputs Hello if I create a new file and copy / paste the same script to it it works! Why does this one file give me the strange characters all the time? ...

How do you remove invalid hexadecimal characters from an XML-based data source prior to constructing an XmlReader or XPathDocument that uses the data?

Is there any easy/general way to clean an XML based data source prior to using it in an XmlReader so that I can gracefully consume XML data that is non-conformant to the hexadecimal character restrictions placed on XML? Note: The solution needs to handle XML data sources that use character encodings other than UTF-8, e.g. by specifyi...

How does Ruby 1.9 handle character cases in source code?

In Ruby 1.8 and earlier, Foo is a constant (a Class, a Module, or another constant). Whereas foo is a variable. The key difference is as follows: module Foo bar = 7 BAZ = 8 end Foo::BAZ # => 8 Foo::bar # NoMethodError: undefined method 'bar' for Foo:Module That's all well and good, but Ruby 1.9 allows UTF-8 source code. ...

How do you troubleshoot character encoding problems?

If all you see is the ugly no-char boxes, what tools or strategies do you use to figure out what went wrong? (The specific scenario I'm facing is no-char boxes within a <select> when it should be showing Japanese chars.) ...

Problems while submitting a UTF-8 form textarea with JQuery/AJAX

I am having problems submitting forms which contain UTF-8 strings with Ajax. I am developing a Struts web application which runs in a tomcat server. This is the environment i set up to work with UTF-8: I have added to tomcat's conf/server.xml the attributes URIEncoding="UTF-8" useBodyEncodingForURI="true" into the Connector tag. I have...

How can I generate a unique, small, random, and user-friendly key?

A few months back I was tasked with implementing a unique and random code for our web application. The code would have to be user friendly and as small as possible, but still be essentially random (so users couldn't easily predict the next code in the sequence). It ended up generating values that looked something like this: Af3nT5Xf2 ...

Base64 Encoding Image

I am building an open search add-on for Firefox/IE and the image needs to be Base64 Encoded so how can I base 64 encode the favicon I have? I am only familiar with PHP ...

PHP Include function outputting unknown char

When using the php include function the include is succesfully executed, but it is also outputting a char before the output of the include is outputted, the char is of hex value 3F and I have no idea where it is coming from, although it seems to happen with every include. At first I thbought it was file encoding, but this doesn't seem ...

Real-time wmv video encoding in C#

How to encode video on the fly and send it trough the network from C#? Can't find a suitable library. I need to encode in WMV and don't mind if the actual encoding is made in C++ as long as the library has a .NET assembly available. Thanks ...

JavaFX video encoding

On JavaFX's Wikipedia In May 2008 (...) Sun Also announced a multi-year agreement with On2 Technologies to bring comprehensive video capabilities to the JavaFX product family using the company's TrueMotion Video codec. Do you know if it will include encoding capabilities for webcam video like Flash or just playback/stre...

ASP.NET WebService Returns Gibberish Characters When Throwing Exceptions

Greetings! I have a web service (ASMX) and in it, a web method that does some work and throws an exception if the input wasn't valid. [ScriptMethod] [WebMethod] public string MyWebMethod(string input) { string l_returnVal; if (!ValidInput(input)) { string l_errMsg = System.Web.HttpUtility.HtmlEncode(GetErrorMessage...

Problem with unicode String literal in unit test

I have a JUnit test that tests adding Strings to a Dictionary custom type. Everything works fine for everyone else on a Linux/Windows machine, however, being the first dev in my shop on a mac, this unit test fails for me. The offending lines are where unicode string literals are used: dict.add( "Su字/会意pin", "Su字/会意pin" ); dict...

Trying to convert bunch of jpegs into a movie

I have 28,000 images I need to convert into a movie. I tried mencoder mf://*.jpg -mf w=640:h=480:fps=30:type=jpg -ovc lavc -lavcopts vcodec=msmpeg4v2 -nosound -o ../output-msmpeg4v2.avi But it seems to crap out at 7500 frames. The files are named webcam_2007-04-16_070804.jpg webcam_2007-04-16_071004.jpg webcam_2007-04-16_071204.jpg ...

Best practice: escape, or encodeURI / encodeURIComponent

When encoding a query string to be sent to a web server - what is the best practice to use from javascript: Use escape: escape("% +&="); OR use encodeURI() / encodeURIComponent() encodeURI("http://www.google.com?var1=value1&amp;var2=value2"); encodeURIComponent("var1=value1&var2=value2"); ...

Powershell: Setting Encoding for Get-Content Pipeline

I have a file saved as UCS-2 Little Endian I want to change the encoding so I ran the following code: cat tmp.log -encoding UTF8 > new.log The resulting file is still in UCS-2 Little Endian. Is this because the pipeline is always in that format? Is there an easy way to pipe this to a new file as UTF8? ...

How to send SOAP requests in ISO-8859-1 with Flex ?

Flex uses by default UTF-8. I have not fount a way to specify a different encoding/charset on the actionscript WebService class. Thanks in advance for your help ...

What is the best way to change the encoding of text in PHP

I want to run text through a filter to ensure it is all UTF-8 encoded. What is the recommended way to do this with PHP? ...

How to: Pass an ampersand in a lousy filename to a flash object on a webpage

Argghh. I have a site that offers audio previews of songs hosted elsewhere. Some file names have an ampersand in them - see below where it passes "soundFile." Anytime there's an ampersand, Flash can't get the file - I think it drops the filename after the ampersand. It doesn't matter if I pass it as an "&" or an HTML entity ("& a m p ;")...