cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X

Using charent.cf to Alter Certain Characters (Arbortext 6.0)

sangelo
7-Bedrock

Using charent.cf to Alter Certain Characters (Arbortext 6.0)

Hi,

There are certain characters that show up in our raw data that we would like to automatically alter because they cause problems when we finally upload them to our website. Some examples of characters we needed to alter are the mdash (—, unicode 0x2014), rdquo (”, 0x201D), ldquo (“, 0x201C), rsquo (’, 0x2019), lsquo (‘, 0x2018), etc.

I understood that I could use charent.cf for this purpose. As a test, I followed the procedures and copied charent.cf from Arbortext-path\lib to Arbortext-path\custom\lib and edited the file here to replace the Left and Right Pointing Double Angle Quotation Marks (», 0x00BB and «, 0x00AB) with a quote mark ( ", unicode 34). It worked like a charm: when I opened a document containing the double angle quotation marks using Arbortext Editor, they were automatically converted to the quote mark and I was able to save the document with the changes. However, we didn't need this particular change after all so I restored the original lines and added my new conversions for the characters we needed to alter. However, when I opened the document in Arbortext Editor, there were no conversions and the document still contained the original characters.

I tried making changes to the file, rebooting my PC, etc. but no luck. I now have restarted by copying the original charent.cf file from Arbortext-path\lib to Arbortext-path\custom\lib and only changing one character but still no luck. Here are the 2 lines I've changed for mdash:

mdash ascii 45 unicode 45 #replace 0x2014 (—) with 45 -

(for Windowsonly)

mdash ps_ascii 45 unicode 45 psa ":\g151|" #replace 0x2014 (—) with 45 -

(for unixonly)

No luck though. The mdash still remains in my test document when I open it in Arbortext Editor. It's probably something simple because it was working for me before ... but I just can't figure it out.

Any ideas? Thanks.

ACCEPTED SOLUTION

Accepted Solutions
sangelo
7-Bedrock
(To:sangelo)

Sorry, it's been a while since I posed and solved this problem but better late than never.

I had to take a different approach. I first recorded a macro while I manually searched for and replaced the characters in question (i.e. replaced mdash and ndash with a hyphen). Then taking the recorded code which listed each find and replace one after another, I converted this to a loop using while find conditions.

Here is a sample of my final code from my user.mcf file. A simple yet effective solution!

StartOfDocument;

#FindReplace;

  while(find("—", 0x10b20)) {

     replace("—", "-", 0x10920);

    }

StartOfDocument;

#FindReplace;

  while(find("–", 0x10b20)) {

     replace("–", "-", 0x10920);

    }

View solution in original post

2 REPLIES 2
sangelo
7-Bedrock
(To:sangelo)

Sorry, it's been a while since I posed and solved this problem but better late than never.

I had to take a different approach. I first recorded a macro while I manually searched for and replaced the characters in question (i.e. replaced mdash and ndash with a hyphen). Then taking the recorded code which listed each find and replace one after another, I converted this to a loop using while find conditions.

Here is a sample of my final code from my user.mcf file. A simple yet effective solution!

StartOfDocument;

#FindReplace;

  while(find("—", 0x10b20)) {

     replace("—", "-", 0x10920);

    }

StartOfDocument;

#FindReplace;

  while(find("–", 0x10b20)) {

     replace("–", "-", 0x10920);

    }

rdiaz
12-Amethyst
(To:sangelo)

Hi Steve,

Thanks for sharing this with the Community.  Hopefully others can benefit from your example. 

Announcements

Top Tags