encoding

How to get code of unicode character using Ruby 1.8.6?

If I add this to the beginning of my script: $KCODE = 'UTF8' require 'jcode' then I can walk over every char of a word containing unicode characters. Imagine a word containing umlauts or something, and I iterate over them like this: word.each_char do |c| # do something with c end If c is a unicode character and I print it's size,...

how can Weblogic send page with Unicode charset

99.9% of the pages in my application are using UTF-8 encoding. However for some special usecase in the client side, I need one of them to use Unicode (2 bytes for each character) For that matter the header of this page is: <%@ page language="java" contentType="text/html; charset=unicode"%> ...<my content>... This implementation work...

Java equivalent of Pythons urllib.urlencode(HashMap based UrlEncode)

From Whats the java equivalent of Python’s urllib.urlencode? Like >>> urllib.urlencode({'abc':'d f', 'def': '-!2'}) 'abc=d+f&def=-%212' Where I can pass a HashMap of key values and it encodes and gives me the url string .. Edit: I wanted to avoid this scenario String data = URLEncoder.encode("key1", "UTF-8") + "=" + URLEncoder.en...

Splitting string into words with swedish chars

I'm trying to split a string with text into words by using the php-function preg_split. $words = preg_split('/\W/u',$text); It works fine except for swedish chars lite åäö. Doing utf8_encode or decode doesn't help either. My guess is that preg_split only works with single byte chars and that the swedish chars are multibyte. Is there a...

Why my webpage is displayed with question marks, if i switch encoding to UTF-8?

Within the web.config file i have the following, regarding encoding info, since the website is availiale only to Greece. <globalization fileEncoding="windows-1253" requestEncoding="windows-1253" responseEncoding="windows-1253" culture="el-gr" uiCulture="el"/> What changes should i implement if i decide to add the English version of th...

What text encoding scheme do you use when you have binary data that you need to send over an ascii channel?

If you have binary data that you need to encode, what encoding scheme do you use? I know about: Hex encoding. Very simple, but quite verbose, expands one byte to two. Base 64. Most common, not so verbose, expands three bytes to four. Base 85. Not common, less verbose again, expands four bytes to five. Are there any other encoding sc...

Encoding Ruby on Rails code?

Are there any applications out there that will let me encode my Ruby on Rails code so others can't read it? I plan on selling a few small applications, but I really don't want everyone knowing my code. Thanks. ...

how to convert XML encoding="tis-620" to utf-8

any idea how to convert this xml to utf-8 ? <?xml version="1.0" encoding="tis-620" ?> <rss version="2.0"><channel><title>Pantip.com : Tech Exchange - IT NEWS</title><description>ข่าว IT NEWS จาก PANTIP.COM : Tech Exchange ส่งตรงถึงคุณทันเหตุการณ์</description><link>http://www.pantip.com/tech/newscols/&lt;/link&gt;&lt;category&gt;News/...

how to use specific encoding on NSXMLParser ?

how to use specific encoding on NSXMLParser ? It default on utf-8 ,I want to use on tis-620 any idea? ...

Is there an equivalent to .NET's System.Text.Encoding in Java?

I'm looking for an equivalent to .NET's System.Text.Encoding in Java. For example in C# I can do this: Encoding defaultEncoding = Encoding.Default; byte[] encoded = defaultEncoding.GetBytes("Text to encode"); I would like to be able to do the same in Java. ...

How can I find the encoding of a FileItemStream returned by FileItemIterator?

I use Apache Commons FileUpload to receive uploaded files in a Servlet, as described at http://code.google.com/appengine/kb/java.html#fileforms ServletFileUpload upload = new ServletFileUpload(); FileItemIterator iterator = upload.getItemIterator(request); while (iterator.hasNext()) { FileItemStream...

How can I iterate over every character in a given encoding using Python?

Is there a way to iterate over every character in a given encoding, and print it's code? Say, UTF8? ...

Insert string with special characters into RTF

How to programatically insert string with special characters into RTF? I have rtf template I load to string and then replace all $MY_VARIABLE$ with data. Data contains special chars like 'ąęść' and the problem is that in result file these characters are replaced with '?'. It's something wrong with encoding but what? My code looks like:...

.Net Method for converting String to HTML Escape Characters

I want to convert an e-mail address into HTML Escape Characters as a basic way to try and avoid being harvested by spam-bots. Like mentioned in this question: When placing email addresses on a webpage do you place them as text like this: [email protected] or use a clever trick to try and fool the email address ha...

What are some common character encodings that a text editor should support?

I have a text editor that can load ASCII and Unicode files. It automatically detects the encoding by looking for the BOM at the beginning of the file and/or searching the first 256 bytes for characters > 0x7f. What other encodings should be supported, and what characteristics would make that encoding easy to auto-detect? ...

xml utf-16 issue

Hi I am receiving a xml through a http request. The format is like this "<.?.x.m.l. .v.e.r.s.i.o.n.=.\".1...0.\". .e.n.c.o.d.i.n.g.=.\".u.t.f.-.1.6.\".?.>| etc Then i'm getting an error: {"Name cannot begin with the '.' character, hexadecimal value 0x2E. Line 1, position 2."} Trying to convert it to ascii like this, doesn't solve the ...

Which encoding does Microsoft SSIS use to output flat files in Unicode?

Hi, In the Flat File Connection Manager screen there is a checkbox to specify that the file is encoded as Unicode, but there is no way to tell which encoding will be used (UTF-8, UTF-16, ...) Is there an official Microsoft resource as to which encoding is used? Kind regards ...

How to read unicode (utf-8) / binary file line by line

Hi programmers, I want read line by line a Unicode (UTF-8) text file created by Notepad, i don't want display the Unicode string in the screen, i want just read and compare the strings!. This code read ANSI file line by line, and compare the strings What i want Read test_ansi.txt line by line if the line = "b" print "YES!" else pri...

How to decode a string on runtime in java?

I'm creating email client, when i receive emails from blackberry server it sends file name as "=?utf-8?B?anBlZ2F0dGFjaG1lbnQuSlBFRw==?=" but the original filename was "jpegattachment.JPEG", and sometime I get the plain text when I receive from other mail servers. So here my problem is I can get a string which may or may not be encoded. ...

Twitter sharing problems with umlauts ä & ö

I'm having trouble sharing messages containing scandinavian ä & ö to twitter through a share-button on my site. If I use UTF8-codes above %7F, i just bump into an "Invalid Unicode value in one or more parameters" error. An example: http://twitter.com/home/?status=%40user+blah%26%E4 I've tried a bunch of different encodings, but none se...