Convert smart quotes

How can I replace smart quotes that have been entered into a form where the user has pasted from an MSWord document? I want to replace the smart quote with a simple apostrophe. I understand that the smart quote for a single quotation is represented by the following in Flex: ’
Thank you!

If you use regular expressions, you could do it in a single line and much faster:
In the following example, only the first instance of "sh" (case-sensitive)  is replaced:
var myPattern:RegExp = /sh/; 
var str:String = "She sells seashells by the seashore.";
trace(str.replace(myPattern, "sch")); 
    // She sells seaschells by the seashore.
In the following example, all instances of "sh" (case-sensitive)  are replaced because the g (global) flag is set in the regular expression:
var myPattern:RegExp = /sh/g; 
var str:String = "She sells seashells by the seashore.";
trace(str.replace(myPattern, "sch")); 
    // She sells seaschells by the seaschore.
Dany

Similar Messages

  • Convert smart quotes and other high ascii characters to HTML

    I'd like to set up Dreamweaver CS4 Mac to automatically convert smart quotes and other high ASCII characters (m-dashes, accent marks, etc.) pasted from MS Word into HTML code. Dreamweaver 8 used to do this by default, but I can't find a way to set up a similar auto-conversion in CS 4.  Is this possible?  If not, it really should be a preference option. I code a lot of HTML emails and it is very time consuming to convert every curly quote and dash.
    Thanks,
    Robert
    Digital Arts

    I too am having a related problem with Dreamweaver CS5 (running under Windows XP), having just upgraded from CS4 (which works fine for me) this week.
    In my case, I like to convert to typographic quotes etc. in my text editor, where I can use macros I've written to speed the conversion process. So my preferred method is to key in typographic letters & symbols by hand (using ALT + ASCII key codes typed in on the numeric keypad) in my text editor, and then I copy and paste my *plain* ASCII text (no formatting other than line feeds & carriage returns) into DW's DESIGN view. DW displays my high-ASCII characters just fine in DESIGN view, and writes the proper HTML code for the character into the source code (which is where I mostly work in DW).
    I've been doing it this way for years (first with GoLive, and then with DW CS4) and never encountered any problems until this week, when I upgraded to DW CS5.
    But the problem I'm having may be somewhat different than what others have complained of here.
    In my case, some high-ASCII (above 128) characters convert to HTML just fine, while others do not.
    E.g., en and em dashes in my cut-and-paste text show as such in DESIGN mode, and the right entries
        –
        —
    turn up in the source code. Same is true for the ampersand
        &
    and the copyright symbol
        ©
    and for such foreign letters as the e with acute accent (ALT+0233)
        é
    What does NOT display or code correctly are the typographic quotes. E.g., when I paste in (or special paste; it doesn't seem to make any difference which I use for this) text with typographic double quotes (ALT+0147 for open quote mark and ALT+0148 for close quote mark), which should appear in source code as
        “[...]”
    DW strips out the ASCII encoding, displaying the inch marks in DESIGN mode, and putting this
        "[...]"
    in my source code.
    The typographic apostrophe (ALT+0146) is treated differently still. The text I copy & paste into DW should appear as
        [...]’[...]
    in the source code, but instead I get the foot mark (both in DESIGN and CODE views):
    I've tried adjusting the various DW settings for "encoding"
        MODIFY > PAGE PROPERTIES > TITLE/ENCODING > Encoding:
    and for fonts
        EDIT > PREFERENCES > FONTS
    but switching from "Unicode (UTF-8)" to "Western European" hasn't solved the problem (probably because in my case many of the higher ASCII characters convert just fine). So I don't think it's the encoding scheme I use that's the problem.
    Whatever the problem is, it's caused me enough headaches and time lost troubleshooting that I'm planning to revert to CS4 as soon as I post this.
    Deborah

  • Converting MS-WORD characters such as smart quotes into standard quotes

    Hi,
    This is a problem when taking text from a MS Word file and pasting it into a browser editor. The Java code doesnt interpret these smart quotes correctly.
    Any ideas on how to convert these to standard characters that can be understood by Java
    Regards
    Chris

    sorry what i meant was an application called MorelloNot a web application, then? Doesn't run in a browser?
    If so, then where does Java come into this? Is Morello written in Java, or do you have a Java application that is interfacing with Morello in some unspecified way? And where does the console come into it? You said that people were pasting text into Morello, so surely it isn't console-based?
    You clearly have an encoding problem but from your description it's impossible to tell where it arises or what you can do to fix it.

  • Smart quotes not working in Pages 5.5.2

    I'm unable to get smart quotes in Pages.
    I'm on a 2009 iMac, using Yosemite 10.10.1, Pages 5.5.2
    I've followed the instructions on Apple's page (http://help.apple.com/pages/mac/5.0/#/tanad45f9cce) to make all quotes smart quotes in my document and it didn't work.
    When I opened Substitutions in Pages the box for smart quotes was ticked, unticking and reticking and doing 'replace all' made no difference.
    Prior to this I'd just changed the font style setting for the document from Courier New to Times New Roman.
    I've also checked in System Prefs/Keyboard/Text where 'Use smart quotes' is ticked.
    I'm formatting a book, this is holding up production of my book as all quotes are non-curly, straight quotes and need to be changed to smart quotes.
    I'm wondering whether I shouldn't go back to the previous version of Pages where everything seemed to work, including auto capitalisation.

    Additionally re my first post above I've tested for smart quotes in MS Word 2008 and Mail 8.1 and they both support smart quotes. Word also converts between quote types.
    I've had to create a workaround to get my Pages document showing smart quotes:
    I tested smart quote support in Word by pasting a page from the Pages document into Word and then converting the straight quotes to curly quotes. which worked. I then copied that text and pasted it back into a new blank page in Pages, the smart quotes stayed curly. So, I'm about to copy and paste my whole book, 55,000+ words, into Word and convert quotes and then paste it back into Pages.
    It seems like the smart quotes issue is Pages 5.5.2 specific and has been for quite some while.

  • MS Word smart quotes don't paste the same into Forms 10g as Forms 6i

    Hi all,
    I have users who write text in Microsoft Word and then cut-and-paste it into Oracle Forms.
    After some prodding by the developers, the users have switched to using the 10G version of their application instead of the 6i version.
    As a background you should know that Microsoft Word uses Smart Quotes by default, which you can turn off. Smart Quotes are different ascii characters than the ascii 39 single quote and ascii 34 double quote.
    When the users cut-and-paste the Microsoft Word text into the Forms 10G field, the single apostrophe smart quote does not convert to ascii 39. I wouldn't be surprised about this except that in Forms 6i the form does convert the single apostrophe smart quote into ascii 39.
    So if the users use the 6i Form they can cut-and-paste and the form/database has the character as ascii 39. If the users paste into Forms 10G then the database shows the character as ascii 191 (hex 0xBF), which is an inverted question mark.
    Does anyone know of any settings in Forms 10g to revert back to 6i functionality for this?
    Thanks much,
    Troy

    I am afraid that Jan is right.
    And this might be a bit of a hassle, since it might affect your forms. If you are using some standard Windows lettertype in your forms, though, you should be OK.
    Bare in mind, that you the NLS_LANG.characterset will have to be compatible between database and forms (the latter at both compiletime and runtime).
    Good Luck!
    Remco

  • Removing "smart" quotes

    I have an html file that appears to have been created by Word and contains so called "smart" quotes.  How can I convert this file so that it has normal quotes?  I tried Googling and found a couple of vi based solutions but, not being a vi user, I didn't really understand what they're telling me to do...
    Any suggestions?

    “These are smart quotes”
    "These are plain ascii quotes"
    There's a program in the AUR called uni2ascii which will strip unicode chars and replace them with ascii equivalents.
    Should you just want the specific solution, sed will do the trick...
    sed -i.orig 's/[”“]/"/g' filename
    Last edited by falconindy (2011-11-13 15:33:58)

  • Pasting smart quotes and apostrophes in code view.

    Sine upgrading to Dreamweaver CS5, I haven't been able to copy/paste smart quotes and apostrophes into code view without them automatically being converted to straight quotes.
    For example, the following sentence (notice the curly quotes):
    John’s new song is called “DW Blues”
    would get pasted into Code View as:
    John's new song is called "DW Blues"
    Notice the smart quotes and apostrophe are replaced with single and double ticks, or "straight quotes."  While this seems like a minor detail, it's extremely important to our writers and editors to have them appear on the website exactly as typed.
    If I do the same copy/paste in Design View (doc type is XHTML Transitional), it appears as:
    John's new song is called "DW Blues"
    The characters are still replaced, and the straight quotes are then entity encoded (as expected).
    This doesn't happen with other valid UTF-8 characters like ™, ®, —, etc., or with any other code editors I've used, including DW CS3.
    Is there a hidden preference somewhere to disable this "feature," or is it just a bug?
    Please help!

    It's now 4 years since jsparacio posted this, and I just wanted to let everyone know that I had -- and am still having -- the exact same problem with Dreamweaver CS5 (running first under Windows XP, then Windows 7, and now again with Windows 8.1). So it's not just Macs that are affected.
    FWIW, I have set my DW CS5 Paste preferences to the 3rd of 4 options available
        1 - Text Only
        2 - Text With Structure
        3 - Text With Structure Plus Basic Formatting
        4 - Text With Structure Plus Full Formatting
    in the EDIT > PREFERENCES > Copy/Paste Preferences dialog box.
    But the Paste Special command ignores this setting, giving me only the first 2 options from which to choose, with option 2 the default selection for Paste Special operations (options 3 and 4 are grayed out, and can't be selected).
    According to David Sawyer McFarland's _Dreamweaver CS5: The Missing Manual_ (O'Reilly Media, 2010), the reason these are grayed out is because I am pasting unformatted ASCII text which I generated in a program editor called "UltraEdit":
        "... Choose EDIT > PASTE SPECIAL to open the Paste Special window. Here, you can choose which of the four techniques you wish to use ... sort of. You're limited to what Dreamweaver can paste. For non-Microsoft Office products, you can use only the first two options--the others are grayed out--whereas you can choose from any of the four with text copied from Word or Excel." (McFarland, p. 81)
    Regardless of such restrictions, standard copy-and-paste (CTRL+C followed by CTRL+V) works just fine for me using Dreamweaver CS4 (i.e., I have never needed to use the Paste Special command), but with DW CS5, neither Paste command (CONTROL+V or CTRL+SHIFT+V) works properly with typographic/curly/smart quotes.
    All typographic quotes -- ASCII-0146 and ASCII-0147 (double quote marks); plus ASCII-0145 and ASCII-0146 (single quote marks, for quotes within a quote) -- are converted to inch (" is entered in the code) and foot (' is entered in the code) marks when I copy-and-paste text with these characters into Dreamweaver's Design View.
    When I copy this same plain ASCII text directly into the code (rather than using Design View), typographic double open & close quotes are converted to the inch (") mark, and typographic single open & close quotes are converted to the foot (') mark.
    The beginning of this week, I installed Dreamweaver CS5, ver. 11.0, Build 4909 under Windows 8.1 OS on my new Ultrabook. I was hoping that under Windows 8.1, DW CS5's handling of typographic quotes might improve so that I can actually use this program that I purchased 4 years ago. Alas, no such luck: I continue to have the same problem I had when I first upgraded to Dreamweaver CS5 back in August 2010 (then running under Windows XP on my desktop computer).
    Back in August 2020, when I first asked about fixes, I was told to change the Title/Encoding setting of Page Properties to "Western European" -- which I tried, but it didn't work then, and it doesn't work now ... and even if it did, it wouldn't be a proper fix for the problem as I have plenty of good reasons for wanting my HTML page Title/Encoding set to Unicode (UTF-8), not Western European ("charset=iso-8859-1").
    The ability to copy-and-paste typographic quotes is such a big deal for me that I chose back in August 2010 to revert to Dreamweaver CS4, which I've been using ever since.
    It is *very* frustrating that, 4 years later, I still can't use this program, and shall be reverting to DW CS4, yet again.
    I continue to be completely flummoxed by this. Every other program with which I am familiar converts non-typographic quotes to typographic/curly/smart quotes ... never have I seen the process automated in reverse!

  • "Toggle Smart Quotes" doesn't work anymore

    I'm not sure if this stopped working after I upgraded to Snow Leopard (from Leopard) or if it's been a CS4 issue all along, but hitting Cmd+Opt+Shift+' doesn't toggle smart quotes functionality anymore. This is handy for the odd occasion when I actually want feet and inches marks. I trashed preferences and that didn't fix it.
    For what it's worth, this keyboard command is still listed in the Keyboard Shortcuts preferences. It just isn't working.

    I've since learned that I can use Ctrl+' and Ctrl+Shift+' (Mac) for the cheapo feet and inches marks. Thanks for the info about prime marks though, I didn't know about them – that they are the "real" feet and inches marks. I also didn't know that Smart Quotes would convert quotes during copy and paste.
    I must say that I couldn't find prime marks in the Glyphs palette (which would really benefit from a search tool), at least not for the Myriad Pro font. Still, I will keep it in mind for any "important" applications of the feet and inches marks in future. Most of the time I just want them quickly for unimportant uses, at which time I'll just use Ctrl+'. I guess I'm obsessive enough to avoid quotation marks when I mean feet and inches, but not obsessive enough to dig through the Glyphs palette.
    By the way, I scanned through Snow Leopard's keyboard shortcuts preferences and couldn't find a conflicting Cmd+Opt+Shift+' command. It doesn't matter to me anymore though.

  • "Smart Quotes" and Extensions

    I'm working on a text processing extension and want to implement a "Convert special characters to safe HTML entities" (that's just a working title!) menu option.  When I copy and paste some blocks of text from Word into the editor, then right-click my selection and choose my extension to process that text, the text that gets sent via the xml packet to my handler converts (in this case) Word's smart quotes (&#8220 and &#8221) to question marks.  This is before my handler processes anything.  I'm just using cfdump to look at the data.  Am I missing some intermediary processing that needs to be done somehow?  I can't figure out where it would be done since I don't have any control over the selected editor content until my handler is fired.
    Thanks!
    Andy

    The encoding is utf-8 (which is the default in CF 9 (and maybe CF 8 too), but I explicitly set it anyway, and still no luck.  It seems like Word Smart Quotes are actually seen by ColdFusion as 3 different characters.  I don't know that Smart Quotes are actually representable as specific entities, though.  When I copy a closing smart quote out of Word into a cfm file and so something like <cset q = "{smart quote here}">, and then loop over that variable one character at a time and output the ascii values, I get 3 values: 226, 8364, 65533.
    Here's a test that contains Smart Quotes that I just copied from MS Word into this editor, it will be interesting to see how they are represented after I post this message:
    “Test”
    Andy

  • Smart quotes from InDesign export

    When exporting copy from InDesign CS3, the smart quotes do
    not convert to html code. What am I doing wrong?

    quote:
    Originally posted by:
    Newsgroup User
    if you paste this exported file into a good text editor, what
    character is used for the smart quotes?
    I'm not pasting an exported file. I copied and pasted from
    InDesign to Appleworks. Appleworks converts the smart quotes to
    html code when exporting. A pretty nice job, actually, but an extra
    step.
    quote:
    what doctype does the html file in dw have?
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "
    http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <meta http-equiv="content-type"
    content="text/html;charset=utf-8" />
    quote:
    what character is used for where these smart quotes are?
    It shows up as a smart quote in the source, rather than the
    html equivalent.

  • Macros in Acrobat (Changing "smart quotes" to straight quotes in PDF files)

    Is there a way to do macros in Acrobat? We need a macro that will change all of the smart quotes in a pdf file to straight quotes so that they will convert properly when we create the final version of a form that goes to our Xerox printers. We have a macro in Word that does this, but aren't sure how to do it in Acrobat.
    Thanks for the help!
    Ken K. - 2191

    This would be extremely advanced programming for Acrobat; there is
    automation and something a bit like macros but it can't touch the page
    contents. It would have to be a plug-in in C/C++, and it is
    complicated by font encoding and subset issues.
    The subset issue would probably be a killer. In many, perhaps most,
    cases the PDF file that uses smart quotes will have a font that
    includes ONLY the smart quotes, and left out the straight quotes
    because they weren't needed.
    Aandi Inston

  • Find open and close smart quotes

    Dear scripter,
    Here I am trying find whether all the open double smart quotes(") are closed with close double smart quotes("). Here is my small work to find how many open and close quotes.
    myopenqu=app.activeDocument.search("^{", false, false, "^{");
    myclosequ=app.activeDocument.search("^}", false, false, "^}");
    myopenqulength = myopenqu.length;
    myclosequlength = myclosequ.length;
    if(myopenqulength!=myclosequlength)
    alert("Quotes not matched\n"+ myopenqulength +" Open quotes found\n" + myclosequlength +" Close quotes found")
    It works well, the script just alert if I have 25 open quotes and 23 close quotes
    Quotes not matched
    25 Open quotes found
    23 close quotes found
    Now I want to find the quote set where the 24,25th set close quotes are missing?
    Is there any way to find the misisng quotes
    Thanks in advance
    regards
    a r u l
    vpublish.net

    You'd have to look for unmatched quotes, in this case two cases of two open quotes without an intervening closed quote. This is difficult to script in CS2 because it doesn't have GREP natively and because of footnote problems. In CS3/4 it should be possible. But even then it will work only if you don't have quotes within quotes.
    Peter

  • Smart Quotes

    Hi,
    How do you create smart quotes in Photoshop? (Opening and close quotes)
    Thanks!

    It's in the application preferences under type. Just check the Smart Quotes box, and all your quotes will come out right. 

  • Smart quotes and em-dashes in epub file

    When I create an epub file from my InDesign book file, I find that sometimes (not always, thought!) my smart quotes and em-dashes revert to gibberish.
    For example, when I open the epub file, the em-dash is fine, but in chapter 2, it changes to —.
    Does anyone know how I might correct this?
    Thanks so much!

    It sounds like somethings wrong with the chapter's character encoding.  The character encoding is declared in the header of the ePub HTML. From ID it's:
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    This test has UTF-8 declared in the first line of its source code:
    http://www.zenodesign.com/forum/encodetest/UTF8.html
    And this has no encoding
    http://www.zenodesign.com/forum/encodetest/None.html
    Most browsers let you override or choose the character set, so in Safari if you set the character set to View>Text Encoding>default, you'll see a difference between the above links, but if you set it to Unicode (UTF-8) they both display correctly. In FireFox it's View>Character Encoding.
    You can check and edit the contents of the .epub file by changing the extension from .epub to .zip, and then extracting the contents.

  • Find and replace smart quotes with straight quotes?

    I understand I can turn off smart quotes so that I can type straight quotes, but I need to replace hundreds of curly smart quotes with straight quotes, is there a feature that will let me do this? I am using FM8.
    Thanx,
    Willian

    I am using FM9....so I don't know if the same shortcuts apply, but this is what I found out last week.
    Use the Find and Replace tool:
    With smart quotes turned off and the Num Lock key turned on:
    Alt0147 will give you beginning quotation marks
    Alt0148 will give you ending quotation marks
    In the Find box use ALT0147 or ALT0148 for the beginning or ending quotes. When you click in the box and type
    one of the shortcuts the correct quote will be shown in the box.
    In the replace box type the regular straight quotes on your keyboard.
    I was thrilled that it would work!...course you do have to do them separately and be careful not to replace the curly quotes
    that you want to leave in your document.
    Hope this helps using FM8....
    ls

Maybe you are looking for

  • Wont get past "configuring updates stage 3 of 3 0%" and wont let me log into computer..HELP!!!

    heres a picture of the screen i keep getting. -HP Pavilion dv6700 as you can see its home premium i kept getting a vista spyware alert saying i had 34 infected files and wouldn't stop and i also tried updating some things on my laptop while i updated

  • IPhoto Libary cannot be open

    I have recently returned from a trip and tried to organise my photos in order to publish, print, etc. My MBP has a 256Gb SSD and the MacOS partition is pretty small (dumb choice from me, I know) so I created a new library on the NTFS partition. After

  • QosmioPlayer needed for Qosmio G30-177

    I've just bought a Qosmio G30-177 from a friend, but it's not a brandnew laptop and this is my problem. My Lappy cannot using QosmioPlayer , when my lappy turn off i press one of the 11 AV button but my lappy doesn't start QosmioPlayer , instead of t

  • Updated Jar not Downloaded

    For some reason when users launch my program from web start the latest version is not downloaded if the user has an older version in cache. My JNLP file is: <?xml version="1.0" encoding="utf-8"?> <jnlp spec="1.0" codebase="http://slime.tjtech.org/" h

  • 30 .jpg images. Shuffle/resize them, offer a selection of displays?

    I have about 30 .jpg images which I want to display on a page in an attractive way. They are different sizes. Is the a tool that would accept them all, resize as necessary and provide me with a range of different layouts?