Software developers often need to write code that handles chunks of text typed by a user and whose content is therefore unpredictable. Every programming language has methods for dealing with such text. And every programming language has a way of “escaping” certain characters in text that normally have some syntactic meaning in the programming language – for example, quote marks (which most programming languages use to signify the beginning and end of a text string).
Different programming languages use different methods of “escaping” such characters so they can be interpreted as data rather than carrying their usual syntactic meaning. And therein lies a problem for programmers. If you are dealing with multiple programming languages or systems, you sometimes need a way of encoding text so that ALL of the disparate systems it passes through will treat it as data and not mistake some character embedded within it as a signal to terminate the string or whatever.
I recently ran up against this issue while writing a web application that used Javascript, PHP, HTML, and MySQL, as well as the potential for passing bits of text as parameters embedded in a web URL. The standard functions for escaping text were not sufficient to ensure that ANY text entered by the user could make it through all parts of the program without tripping something up. So I decided to create a universal text encoding method that works for any text and any combination of programming languages and systems you might happen to be using.
Here were my requirements:
* Must be able to faithfully encode ANY text that’s valid in Unicode and then decode it to be identical to the original.
* After being encoded, the string must consist of nothing but the ASCII alphabetic letters (a-z, A-Z) and digits (0-9), plus a single “escape” character.
* An application must be able to designate ANY Unicode character code as the escape (except the ASCII letters and digits), so as to avoid collisions with whatever languages or systems it needs to be compatible with.
* It should not matter if the chosen escape character happens to occur in the text that is to be encoded.
* Any program must be able to decode the text without having prior knowledge of what character was used as the escape during encoding.
* The encoded text should be basically readable by a human.
I came up with a method that satisfies all of these requirements. I call it ZvvyCode. (That’s two v’s in “Zvvy”. I pronounce it “zivy”.)
My full write-up on Zvvycode is here: http://just.thinkofit.com/zvvycode
Different programming languages use different methods of “escaping” such characters so they can be interpreted as data rather than carrying their usual syntactic meaning. And therein lies a problem for programmers. If you are dealing with multiple programming languages or systems, you sometimes need a way of encoding text so that ALL of the disparate systems it passes through will treat it as data and not mistake some character embedded within it as a signal to terminate the string or whatever.
I recently ran up against this issue while writing a web application that used Javascript, PHP, HTML, and MySQL, as well as the potential for passing bits of text as parameters embedded in a web URL. The standard functions for escaping text were not sufficient to ensure that ANY text entered by the user could make it through all parts of the program without tripping something up. So I decided to create a universal text encoding method that works for any text and any combination of programming languages and systems you might happen to be using.
Here were my requirements:
* Must be able to faithfully encode ANY text that’s valid in Unicode and then decode it to be identical to the original.
* After being encoded, the string must consist of nothing but the ASCII alphabetic letters (a-z, A-Z) and digits (0-9), plus a single “escape” character.
* An application must be able to designate ANY Unicode character code as the escape (except the ASCII letters and digits), so as to avoid collisions with whatever languages or systems it needs to be compatible with.
* It should not matter if the chosen escape character happens to occur in the text that is to be encoded.
* Any program must be able to decode the text without having prior knowledge of what character was used as the escape during encoding.
* The encoded text should be basically readable by a human.
I came up with a method that satisfies all of these requirements. I call it ZvvyCode. (That’s two v’s in “Zvvy”. I pronounce it “zivy”.)
My full write-up on Zvvycode is here: http://just.thinkofit.com/zvvycode

