/    Sign up×
Community /Pin to ProfileBookmark

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.

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@Declan1991Apr 19.2010 — Well that's not a valid RegExp.for (ji=0;ji&lt;32;ji++) {
bb=bb.replace(String.fromCharCode(ji), " ");
}

for (ji=91;ji&lt;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");
Copy linkTweet thisAlerts:
@kinaauthorApr 19.2010 — I think the code is right.

Maybe the problem is not a single character ??
Copy linkTweet thisAlerts:
@kinaauthorApr 19.2010 — 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 ?
Copy linkTweet thisAlerts:
@kinaauthorApr 20.2010 — 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!
×

Success!

Help @kina spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.20,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...