| By Lori MacVittie | Article Rating: |
|
| November 2, 2009 06:03 AM EST | Reads: |
377 |
You can address the problem of converting smart quotes – and any other content - in your application if you control the code. What if you’re using third-party software for which you do not have the code? Or what if it is your code but the “defect” is so low on the priority list that you won’t get to it until the year 2020?
Dealing with Microsoft smart quotes is a fact of life for developers. Almost every developer out there has a server-side script/function they use to strip them out of user-generated content and replace them with web-friendly HTML entities instead. But handling smart quotes in application code isn’t always possible or as high a priority as other tasks. If you were looking for a way to address smart quotes once and for all, across multiple applications with one, centralized simple method then a network-side scripting solution may be the answer.
COMMON SOLUTIONS
The solutions available today to address this annoyance are many but almost always involve either some client-side process or script, or the modification of server-side applications to recognize and replace the smart quotes with “dumb” HTML representations instead.
Solutions that require modification of the application work just fine, but must be implemented in every application for which such functionality is required. Another option is to simply enforce a “don’t use Microsoft tools to create web-based content.” That policy is likely to go over like a box of rocks as Microsoft tools are pervasive throughout most enterprise organizations.
Our department spends a lot of time pasting out of Word and into MT, and smart/curly quotes come out as question marks in some browsers. I was teaching staff to save as text first, open that in SimpleText or NotePad, and paste from there. They hated me for it. – forum post at SixApart discussing the problem of Microsoft “Smart Quotes” and how to get rid of them
In some situations there may be no viable solution other than a process similar to the one described in the forums at SixApart because you do not have access to the source code for the application.
THE NETWORK-SIDE SOLUTION
There is another solution to this problem, one that doesn’t require modifying the applications nor attempting to foist unenforceable policies on users nor requiring users to install or remember to use client-side plug-ins: network-side scripting. Using a network-side script on an application delivery controller (load balancer) offers a way to intercept the requests and replace any smart quotes with dumb quotes for all applications it delivers.
1. The client creates the content however they like, and enters it into the web application. It contains smart quotes.
2. The application delivery controller, which is already acting as a proxy for the application, sees the request and performs a search through the content to find all the smart quotes and then replaces them with dumb quotes.
3. The request is sent to the application with the modified content.
Alternatively, the application delivery controller can perform the search and replace of smart quotes with dumb quotes on the response instead.
- The client sends a request
- The application delivery controller notes the URI and determines the response will need processing
- When the response is received by the application delivery controller it executes logic to find all the smart quotes and replace them with their respective HTML entities.
In either case – replacement on request or response - the execution of the network-side script is transparent; neither the user nor the application is necessarily aware of the script and change to the content. The application delivery controller can further be configured such that only the URIs (requests) specifically known to contain content that might include smart quotes will be examined, thus alleviating any potential concerns about the impact of search and replace functionality on performance.
Here’s an example of modifying content on the response. Notice that when the request is received you need to set a flag only if the URI is one for which you know will need to be “scrubbed” of quotes:
Published November 2, 2009 Reads 377
Copyright © 2009 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Lori MacVittie
Lori MacVittie is responsible for education and evangelism of application services available across F5’s entire product suite. Her role includes authorship of technical materials and participation in a number of community-based forums and industry standards organizations, among other efforts. MacVittie has extensive programming experience as an application architect, as well as network and systems development and administration expertise. Prior to joining F5, MacVittie was an award-winning Senior Technology Editor at Network Computing Magazine, where she conducted product research and evaluation focused on integration with application and network architectures, and authored articles on a variety of topics aimed at IT professionals. Her most recent area of focus included SOA-related products and architectures. She holds a B.S. in Information and Computing Science from the University of Wisconsin at Green Bay, and an M.S. in Computer Science from Nova Southeastern University.
- Maybe Ubuntu Enterprise Cloud Makes Cloud Computing Too Easy
- Meh. It's Just Data.
- The API Is the New CLI
- Amazon Elastic Load Balancing Only Simple On the Outside
- Data Portability in The Cloud
- Study Says Economics Not A Driving Factor in Cloud Computing Adoption
- The Cloud Is Not A Synonym For Cloud Computing
- To Take Advantage of Cloud Computing You Must Unlearn, Luke
- Data as a Service Could Drastically Impact Success of SQL Injection Attacks
- Scaling Security in the Cloud: Just Hit the Reset Button
- Cloud, Standards, and Pants
- When Cloud Is Both the Wrong and the Right Solution
- If Load Balancers Are Dead Why Do We Keep Talking About Them?
- Maybe Ubuntu Enterprise Cloud Makes Cloud Computing Too Easy
- Cloud Computing versus Cloud Data Centers
- Developing APIs for the Cloud
- Does a Dynamic Infrastructure Need ARP for Applications?
- Linux is Not the Answer to Security Problems
- Excuse Me But Is That a Gazebo On Your Site?!
- Meh. It's Just Data.
- The API Is the New CLI
- The Cloud Metastructure Hubub
- Amazon Elastic Load Balancing Only Simple On the Outside
- Data Portability in The Cloud
- Disaster Recovery in a Web 2.0 World
- Finding New Life For SOA in the Cloud
- Is Social Media a Hostile Work Environment?
- Dear Slashdot: You Get What You Pay For
- Get Your SaaS Off My Cloud
- If Load Balancers Are Dead Why Do We Keep Talking About Them?
- Governance: Service Catalogs and the Cloud
- Twittergate Reveals E-Mail is Bigger Security Risk than Twitter
- Cloud Computing Is Not Burger King
- The Revolution Continues
- Differentiating the Application Network from the Network
- Two Different Sock(et)s


















