Results 1 to 4 of 4
  1. #1
    Newbie
    Join Date
    December 13th, 2008
    Posts
    13
    Using the Replace command with non-ASCII characters
    I'm working with some descriptions where I want to replace some of the text with html. For instance in the body there is the word "InsertParagraph". I want to replace this with a <P>. However, Webmerge replaces it with the actual code, &lt;P&gt;

    I have tried the "raw" attribute which seems to work, but created other problems as some of the descriptive text uses curly quotes and em dashes which do not show up correctly.

    Is there a way to get webmerge to insert the code instead. An example of the webmerge tag is below.

    [WM-Field: Description replace("InsertParagraph"," <P> ")]

    Thanks

  2. #2
    Affiliate Manager
    Join Date
    January 18th, 2005
    Location
    Los Angeles, California
    Posts
    1,913
    What's happening is that WM is doing the replace first, then reformatting any character entities. Your hunch with using "raw" is a good one, but will indeed have the side-effect you noted, that it will then prevent WM from converting any other character entities.

    Instead of replacing the "InsertParagraph" string with an HTML tag you might try replacing it with a return character instead, using the constant "CR":

    [WM-Field: Description replace("InsertParagraph", CR)]

    Note that CR, like other supported constants, should not be in quotes, since putting it in quotes would tell WM that it's a string and not a constant, and you'd simply get the letters "CR" instead of a return character.

    Once that replace is done, WM will then replace all CRs with "<br>", which should produce the result you're looking for.

    Let me know if it gives you any trouble.
    Richard Gaskin
    Developer of WebMerge: Publish any data feed on any site
    http://www.fourthworld.com

  3. #3
    Newbie
    Join Date
    December 13th, 2008
    Posts
    13
    Thanks,

    I had worked out a sort of clumsy workaround but your solution sounds much better.

    Is there a list of the supported constants somewhere?

    BTW. Glad you see you back in the forums after a short break. I don't post much but have found many webmerge solutions by looking through your forums entries!

  4. #4
    Affiliate Manager
    Join Date
    January 18th, 2005
    Location
    Los Angeles, California
    Posts
    1,913
    Quote Originally Posted by jaehunkim View Post
    Is there a list of the supported constants somewhere?
    Not as such in v2.6, but that documentation issue will be addressed in v2.7. The only problematic ones as far as I can anticipate at the moment are ";", "(", and ")", since those are used by the parser to determine the replace expressions. Any of those three can be escaped with a preceding "\", e.g. "\;".

    BTW. Glad you see you back in the forums after a short break. I don't post much but have found many webmerge solutions by looking through your forums entries!
    Thanks. Between a vacation and burying myself in Unicode documentation it's been a difficult few weeks, but I think I see light at the end of the tunnel now and look forward to dropping in here more regularly.
    Richard Gaskin
    Developer of WebMerge: Publish any data feed on any site
    http://www.fourthworld.com

  5. Newsletter Signup

+ Reply to Thread

Similar Threads

  1. Replace Command
    By wow100 in forum WebMerge (Fourthworld.com)
    Replies: 1
    Last Post: November 11th, 2009, 05:48 PM
  2. How can I replace commas. Replace wont' do it
    By sotonman in forum WebMerge (Fourthworld.com)
    Replies: 8
    Last Post: April 25th, 2007, 04:37 AM
  3. Does anybody know the GET command
    By kbrock in forum Rakuten LinkShare - LS
    Replies: 6
    Last Post: January 17th, 2007, 10:04 AM
  4. MySQL + English Characters + Mandarin Characters
    By popdawg in forum Programming / Datafeeds / Tools
    Replies: 2
    Last Post: October 8th, 2006, 01:05 PM
  5. Get same result for every command
    By dpam in forum Cusimano.com Scripts
    Replies: 4
    Last Post: September 12th, 2003, 07:17 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •