Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - Smart-quote behavior: Is current behavior ideal?

Reply
 
Old 08-16-2006   #1 (permalink)
Alex K. Angelopoulos [MVP]


 
 

Smart-quote behavior: Is current behavior ideal?

Since early in the beta, PowerShell has treated smart quote characters as
interchangeable with their ASCII counterparts. In other words, all of the
following act like a double quote character:
" (character 0x0022, Double Quotation Mark)
" (character 0x201c, Left Double Quotation Mark)
" (character 0x201d, Right Double Quotation Mark)
And the following are treated as interchangeable single quotes:
' (character 0x0027, Single Quotation Mark)
' (character 0x2018, Left Single Quotation Mark)
' (character 0x2019, Right Single Quotation Mark)

I was one of the people proposing this choice, for the following reasons:
(1) Admins often perform cut-and-paste from web pages or Word documents, all
of which may end up with hard-to-detect smartquoting in code samples due to
autoreplacement features.
(2) The grammar for at least one .NET language, VB.NET, specifically treats
these characters in this way as well.

I'm curious now about other opinions on this feature. I can't see any major
issues with it, although I have noticed that smart double quote characters
are allowed in file names, potentially causing problems in some string
expansion scenarios. There are also some other interesting possible tweaks,
although they clearly can't be done for first release and might be more
trouble than they are worth. Here are the alternative treatments I was
thinking of:

(1) Smart quotes as distinct quotes:
It might be useful to treat smart quotes as distinct from their ASCII
counterparts. For example, a smart double quote, whether open or close,
could delimit a string containing normal double quotes. Smart double quoted
strings would allow substitution just as normal double quoted strings do;
smart single quoted strings would not allow substitution and could contain
ASCII single quotes.

(2) Directional smart quotes:
Like (1), but if you are delimiting a string with smart quotes it must start
with a left quote marker and end with a right quote marker.

The most significant disadvantage I see to either possibility is that it can
be hard to identify smart quotes even in Consolas - the most clear font when
small-sized - and it is virtually impossible with raster fonts.





My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Bizarre WLM behavior: Live Mail
IE7 behavior Vista performance & maintenance
Odd behavior of WMP GUI Vista music pictures video
Mouse behavior? Vista General
rdp behavior Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46