PDA

View Full Version : Using #146 for quotes????


kitchin
07-05-2005, 03:36 PM
I'm working with a Perl script that replaces all quotes, single and double, with character #146 before putting the data into a database (CVS or MySQL). Is this weird or normal?

I did some research on character #146, which looks like a right-slanted quote in Windows. Lets see how this displays in vBulletin.

Character 0x92, #146 in various character sets:

ASCII
Undefined.

ISO 8859-1, ISO 8859-2, etc. (note, one hyphen in name)
Undefined.

ISO-8859-1 (note, two hyphens), code page 819
PRIVATE USE TWO (PU2).

Code Page 437, CP437 (IMB PC, DOS)
Equivilent to Unicode U+00C6, #0198, and entity 'AElig'.
& #x00C6; [Æ]
& #0198; [Æ]
& AElig; [Æ]

MacRoman
Equivilent to Unicode U+00ED, #0237, and enitity 'iacute'.
& #x00ED; [í]
& #0237; [í]
& iacute; [í]

Windows-1251, Code Page 1252, "ANSI Character Set"
Equivilent to Unicode U+2019, #2019, and entity 'rsquot'.
& #x2019; [’]
& #8217; [’]
& rsquot; [’]

Unicode
U+0146 is undefined.
What about the UTF-8 encoding of Unicode?
Well, UTF-8 is robust of course: no UTF-8 code starts with byte #146.


Here's a what one Wikipedia article (http://en.wikipedia.org/wiki/Table_of_Unicode_characters%2C_128_to_999) says, which sounds sensible:Even if characters in the range 128 to 159 display something sensible on your browser, they cannot be relied upon to display the same thing — or anything at all — on any other browser, so they should never be used.

So I'm thinking of changing the Perl to code to do this: store #146 in the database, but display it as quote, single or & quot;. I don't want to rewrite the whole script.

Randall
07-05-2005, 06:07 PM
I'm working with a Perl script that replaces all quotes, single and double, with character #146 before putting the data into a database (CVS or MySQL). Is this weird or normal? Weird or not, it doesn't really matter if you're doing a two-way conversion. You can use anything you want as the "encoded" form, as long as you output something recognizable. :wink:

But if you use #146 for single and double quotes, how will you know which one to output?

I would really like to start using “proper” quotes on my sites for asthetic reasons (it never occured to me that it would get around the whole quoting thing). But typing “ is a pain because (a) I can never remember the correct unicode number and (b) it's really hard to read. Using “illegal” curly quotes and cleaning them up at the output stage would make it a lot friendlier.

Thanks for corrupting me. :EG:

Randall

Andilinks
07-05-2005, 07:20 PM
I am confused on this issue though maybe I should pay attention because my VBA scripts use quotes as an operator and that has always made manipulating links a problem. I have developed work-arounds and really want to dump VBA for something better, like perl. I store quotes as quotes in my database. Would #146 break a link on an html page? Maybe I should just try it, my gut says yes...

I may regret getting involved in this at all... sigh. I think I'm more confused now which is why I've stuck with VBA and my work-arounds all these years.

Andi

Randall
07-05-2005, 08:35 PM
I am confused on this issue though maybe I should pay attention because my VBA scripts use quotes as an operator and that has always made manipulating links a problem. This is generally not something you want to do to code that's going to be executed as such, whether it be VBA arguments or HTML attributes. It won't parse correctly with curly quotes. But you can store it that way in a database (or just a variable) as long as you convert the curlies back to straight quotes before you output it to your HTML file.

In my case, I'm dealing with the page content, not the tags. But you're right -- remembering to quote your quote marks in VBA/VBScript is a pain.

Randall