Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8665713
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:33:05+00:00 2026-06-12T17:33:05+00:00

The big problem I am having is when users copy things straight from WORD

  • 0

The big problem I am having is when users copy things straight from WORD into fields, causing the xml I am generating to be invalid. I have found a multitude of different approaches to this problem, but what would be considered the grooviest way of removing these invalid characters, whether they come from WORD or not, from my xml?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T17:33:06+00:00Added an answer on June 12, 2026 at 5:33 pm

    I wrote a Java class (7 years ago now, looking at the timestamp) with a single static method to try and clean up text posted from Word.

    It’s here if you’re interested:

    /**
     * <p>Title: Word Cleaner</p>
     * <p>Description: Strips out all of the rubbish that Word tends to generate (open, close quotes, etc)</p>
     *
     * Based on John Walker's "Demoroniser" Perl script : http://www.fourmilab.ch/webtools/demoroniser/
     */
    public class WordCleaner
    {
      private WordCleaner() {}
    
      public static String runWordCleaner( String input )
      {
        StringBuffer sb = new StringBuffer() ;
    
        int len = input == null ? 0 : input.length() ;
        for( int i = 0 ; i < len ; i++ )
        {
          int c ;
          switch( c = (int)input.charAt( i ) )
          {
            case 0x82 : sb.append( "," ) ; break ;
            case 0x83 : sb.append( "f" ) ; break ;
            case 0x84 : sb.append( ",," ) ; break ;
            case 0x85 : sb.append( "..." ) ; break ;
            case 0x88 : sb.append( "^" ) ; break ;
            case 0x89 : sb.append( "ppt" ) ; break ;
            case 0x8B : sb.append( "<" ) ; break ;
            case 0x8C : sb.append( "Oe" ) ; break ;
            case 0x91 : sb.append( "'" ) ; break ;
            case 0x92 : sb.append( "'" ) ; break ;
            case 0x93 : sb.append( "\"" ) ; break ;
            case 0x94 : sb.append( "\"" ) ; break ;
            case 0x95 : sb.append( "*" ) ; break ;
            case 0x96 : sb.append( "-" ) ; break ;
            case 0x97 : sb.append( "--" ) ; break ;
            case 0x98 : sb.append( "~" ) ; break ;
            case 0x99 : sb.append( "TM" ) ; break ;
            case 0x9B : sb.append( ">" ) ; break ;
            case 0x9C : sb.append( "oe" ) ; break ;
            case 0xA9 : sb.append( "(c)" ) ; break ;
            case 0xAE : sb.append( "(r)" ) ; break ;
            case 0xBC : sb.append( "1/4" ) ; break ;
            case 0xBD : sb.append( "1/2" ) ; break ;
            case 0xBE : sb.append( "3/4" ) ; break ;
            case 8208 : sb.append( "-" ) ; break ;
            case 8209 : sb.append( "-" ) ; break ;
            case 8211 : sb.append( "--" ) ; break ;
            case 8212 : sb.append( "--" ) ; break ;
            case 8213 : sb.append( "--" ) ; break ;
            case 8214 : sb.append( "||" ) ; break ;
            case 8215 : sb.append( "_" ) ; break ;
            case 8216 : sb.append( "'" ) ; break ;
            case 8217 : sb.append( "'" ) ; break ;
            case 8218 : sb.append( "," ) ; break ;
            case 8219 : sb.append( "'" ) ; break ;
            case 8220 : sb.append( "\"" ) ; break ;
            case 8221 : sb.append( "\"" ) ; break ;
            case 8222 : sb.append( ",," ) ; break ;
            case 8223 : sb.append( "\"" ) ; break ;
            case 8226 : sb.append( "*" ) ; break ;
            case 8227 : sb.append( ">" ) ; break ;
            case 8228 : sb.append( "*" ) ; break ;
            case 8229 : sb.append( ".." ) ; break ;
            case 8230 : sb.append( "..." ) ; break ;
            case 8231 : sb.append( "-" ) ; break ;
            case 61514 : sb.append( ":-)" ) ; break ;
            case 61515 : sb.append( ":-|" ) ; break ;
            case 61516 : sb.append( ":-(" ) ; break ;
            default : sb.append( (char)c ) ;
          }
        }
        return sb.toString() ;
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having a pretty big problem. I am allowing users to search for
I'm having a big problem with my Lacie NAS 1TB drive, which doesn't seem
I'm having a pretty big problem trying to create navigation on my page. If
Here is a (big) example of the massive problem I am having, when this
I am having a big problem trying to connect to mysql. When I run:
Have a problem that seems easy on paper but i'm having a big problem
I'm having a big problem trying to do map an entity to another that
I'm having a big problem trying to get my head round how the selectable()
Having problems gaining access to a users photo's from my Facebook app. I request
I am having a big problem with FBML app generated notifications. The app sends

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.