encode

passing special characters with encodeURI in javascript

I have an HTML input field linked to a button with an onclick function in javascript that can pass the textfield value to a textfield of another page. While passing the values from one page to another via an URL request of a JSP, I found out that encoding the values with encodeURI() gets : £ --> £ (2 signs !!) ö --> ö (2 signs !!) ...

Search form url structure

We are building a large search interface with close to 70 properties. Most of these properties are boolean (only hold 0 or 1), around 12 are with int values and some are string. goal: http://www.example.com/q/test_search/fdgREGd3vfS323 want to avoid: http://www.example.com/q/test_search/?val_12=1000&val_120=0&val_4=XY.... Our ...

Proper replacement for usage of the Sun internal com.sun.image.codec.jpeg package?

We have some code kicking around that uses this old internal Sun package for manipulating images, essentially encoding JPEGs to a specific size and quality after reading in / decoding from an inputstream. Code examples below. I would appreciate a best practice replacement example using proper java.* or javax.* APIs. private void encod...

AJAX POST and Plus Sign ( + ) -- How to Encode?

I'm POSTing the contents of a form field via AJAX to a PHP script and using Javascript encode(field_contents). The problem is that any plus signs are being stripped out and replaced by spaces. How can I safely 'encode' the plus sign and then appropriately 'decode' it on the PHP side? ...

Encrypt in C# decrypt in JavaScript

I am looking for way to encrypt string in C# and to decrypt it using JavaScript. JavaScript in this case is a scripting language for internal system, so I should not worry about people accessing private key/password which will be required for decryption. Searching online for solution it seems that AES encryption should do the trick. I’...

[PHP] Problem with json_encode()

Hi all, i have an simple array: array 0 => string 'Kum' (length=3) 1 => string 'Kumpel' (length=6) when I encode the array using json_encode(), i get following: ["Kum","Kumpel"] My question is, what is the reason to get ["Kum","Kumpel"] instead of { "0" : "Kum", "1" : "Kumpel" }? ...

How to encode media in base64 given URL in Ruby

I'm trying to upload an image to PingFM. Their documentation says: media – base64 encoded media data. I can access this image via the URL. I tried (practically guessed) this: ActiveSupport::Base64.encode64(open("http://image.com/img.jpg")) But I get this error: TypeError: can't convert Tempfile into String from /usr/lib/ruby/...

PHP URL Encoding Method

Hi guys I would like to know how I can have PHP display this URL correctly. Is there a working encoding method I can use that converts all this: 253A%252F%252F to :// https%253A%252F%252Fvideos-private.s3.amazonaws.com%252Flesson05.flv ...

Convert from hex string to unicode

How can i convert the 'dead' string to an unicode string u'\xde\xad'? Doing this: from binascii import unhexlify out = ''.join(x for x in [unhexlify('de'), unhexlify('ad')]) creates a <type 'str'> string '\xde\xad' Trying to use the Unicode.join() like this: from binascii import unhexlify out = ''.join(x for x in [u'', unhexlify('d...

jQuery parsing RSS and namespaced element like <content:encoded>

I am using jQuery to parse an RSS feed. Within each <item> is a namespaced element like <content:encoded> I want to select. How do I select it in jQuery? $(xml).find('item') works but $(xml).find('item content') does not. ...

convert encoding

hi all just wrote this: <?php function unicodeConvert($str) { header('Content-Type:text/html; charset=UTF-8'); $entityRef = array('"' => "&quot;", "&" => "&amp;", '¢' => "&cent;", '¤' => "&curren;", '¦' => "&brvbar;", '¨' => "&uml;", 'ª' => "&ordf;", '¬' => "&not;", '®' => "&reg;", '°' => "&deg;", '²' => "&sup2;", '´' => "&acut...

converting from base 10 to base 31 (working only with select characters)

I'd like to convert base 10 numbers to base 31 I would like to use only these characters: 23456789abcdefghjkmnpqrstuvwxyz As you can see, 5 characters are excluded (i don't need these): 1 0 o l i The function I have now is below but of course it doesn't work. When 2 is input it outputs 4. The output for tenTo31(2) should be 2 functio...

Sending variables to php from Cocoa Touch on iPhone sdk

Hi am trying to pass variables to php from inside an app. <?php // get email address $email = $_GET['email']; // get character name $character = $_GET['character']; // get password $charname = $_GET['charname']; // set up variables $id = 0; $idtest="no"; // set up database connection $link = mysql_connect("localhost", "xxx username xx",...

Why does reddit use base36 for article id?

For example, "a2xki" ...

How can I call a standard .NET assembly within SQL

Hi, I am having an issue whereby a column within a table of mine has data which is encoded using the System.Xml.XmlConvert.Encode method. Now I need to manipulate this data within SQL and have not found a way to duplicate the System.Xml.XmlConvert.Decode method. So I've been investigating how I can use the System.XML namespace within S...

String encoding of primitive types preserving lexicographic order

Does anyone know of a library for encoding a number of primitive types (like integers, floats, strings, etc) into a string but preserving the lexicographical order of the types? Ideally, I'm looking for a C++ library, but other languages are fine too. Also, one can assume that the format does not need to be encoded in the string itself ...

Invalid PHP JSON encoding

I'm working on a project in PHP (5.3.1) where I need to send a JSON string to a webservice (in python), but the result I get from json_encode does not pass as a valid JSON (i'm using JSLint to check validity). I should add that the structure I'm trying to encode is fairly big (13K encoded), and consists partially of UTF8 data, and while...

URL Escaping Chinese/Japanese Unicode Characters for Internet Explorer

I'm trying to URL-escape (percent-encode) non-ascii characters in several URLs I'm dealing with. I'm working with a flash application that loads resources like images and sound clips from these URLs. Since the filenames can contain non-ascii characters, like so: 日本語.jpg I escape them by utf-8 encoding the characters, and then percent-esc...

I just want to download this URL...but it is giving me an error! ...unicode.. (Python)

theurl = 'http://bit.ly/6IcCtf/' urlReq = urllib2.Request(theurl) urlReq.add_header('User-Agent',random.choice(agents)) urlResponse = urllib2.urlopen(urlReq) htmlSource = urlResponse.read() if unicode == 1: #print urlResponse.headers['content-type'] #encoding=urlResponse.headers['content-type'].split('charset=')[-1] #htmlSour...

URL-encode parameters in ActionLink?

Hi, I have the following route registered; routes.MapRoute( "LocationsByArea", "Locations/{system}/{storage}/{area}", new { controller = "StorageLocation", action = "Index" }, null ); ...and the following code in my...