www.webdeveloper.com
Results 1 to 5 of 5

Thread: Need to remove empty square symbol from text

Hybrid View

  1. #1
    Join Date
    Sep 2009
    Posts
    27

    Unhappy Need to remove empty square symbol from text

    I have been looking for days for a way to do this but have made no progress.

    The text looks fine in php but when displayed by javascript, some of the spaces are shown as an empty square symbol.

    I have tried the following to change any unusual character to a space, but it doesn't help.

    for (ji=0;ji<32;ji++) {
    bb=bb.replace(/String.fromCharCode(ji)/g, " ");
    }

    for (ji=91;ji<256;ji++) {
    bb=bb.replace(/String.fromCharCode(ji)/g, " ");
    }

    I believe that the character is created by a javascript-based editor when either the delete or backspace key is used to make an edit.

    I have this strange symbol in many articles so I need a way to deal with this (the articles display fine when displayed by a php CMS).
    I'm using javascript to show a preview of the article as a link tooltip.

    Any help would be greatly appreciated.
    Last edited by kina; 04-19-2010 at 06:08 PM.

  2. #2
    Join Date
    Aug 2007
    Posts
    3,767
    Well that's not a valid RegExp.
    Code:
    for (ji=0;ji<32;ji++) {
    bb=bb.replace(String.fromCharCode(ji), " ");
    }
    
    for (ji=91;ji<256;ji++) {
    bb=bb.replace(String.fromCharCode(ji), " ");
    }
    But you can pass strings to replace. An other possibility would be new RegExp(String.fromCharCode(ji),"gi");

  3. #3
    Join Date
    Sep 2009
    Posts
    27
    I think the code is right.

    Maybe the problem is not a single character ??

  4. #4
    Join Date
    Sep 2009
    Posts
    27
    Declan -

    Maybe you're right, changed as you suggested and it does replace chars now, but i still see the empty square symbol instead of a space

  5. #5
    Join Date
    Sep 2009
    Posts
    27
    Ok, here's what I'm talking about ...

    http://www.beijingbuzzz.com/beijing/

    Hover mouse over the hot-air balloon image and the tooltip shows a small square where a space should be. The text is retrieved by ajax from a php script. The php shows no sqaure, just the correct space.

    http://www.beijingbuzzz.com/beijing/e.php?id=550

    where 550 is the article id.

    Something about use of rubout. The square appears when have rubbout text.

    Help!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles