------art_31651_32703654.1187046418066
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On 8/13/07, Phrogz <phrogz / mac.com> wrote:
>
> On Aug 13, 3:03 am, greg <greg.johnse... / gmail.com> wrote:
> > How can you encode a ENTER? In case of space: \s, what about ENTER?
>
> On MacOS (before version X), pressing the 'return' key inserted a
> carriage return (CR) character, ASCII value 13, represented in a Ruby
> string by "\r".
>
> On *nix-variants (including Mac OS X), pressing the (enter/return) key
> inserts a line feed (LF) character, ASCII value 10, represented in a
> Ruby string by "\n".

Well, actually terminal drivers on unix are usually responsible for the \r
-> \n conversion, when you hit the Enter  key. (When they had "Return"
written on them, it was because it was short for carriage return).  You can
turn this off with stty.


On Windows, pressing the 'enter' key key inserts a CR/LF pair,
> representable in a Ruby string as "\r\n".
>
> Thankfully, MacOS is no more, and now there are only two flavors to
> work with. Unfortunately, more disparities abound than just text
> files.
>
> In Firefox (and Safari) on Windows, the line endings for <textarea>
> elements in web pages are exposed to JS as LF characters. In IE on
> Windows, the line endings are CR/LF pairs. (I don't have any other
> browsers/OS readily available to test right now.)
>
> Does that help?
>
>
>

------art_31651_32703654.1187046418066--