Square character in text files

Posted on 2005-04-05
Medium Priority
Last Modified: 2010-08-05
I'm asking this question in the perl area because I'm writing a perl script and I want to delete this square character from a bunch of files before I combine them. So, onto the question....

In text files, I occasionally encounter a square character. It appears as if it is just a space, but one can search for it specifically (after copying it) and get rid of it. What is this character? I've done some searches and have come up with nothing. Thanks.
Question by:Feyo
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Expert Comment

ID: 13706359
Hi Feyo,

I think your text editor will show you that square character if it encounters any non-standard ascii character that it does not know how to display.  If you open your file in a hex editor, you will be able to see what it really is, try Hex Workshop http://www.bpsoft.com/ or something similar.

LVL 16

Expert Comment

ID: 13706815
Did you transfer this file from Unix to Windows or vice-versa??

Author Comment

ID: 13707092
The original data comes from scanforms and it goes directly into Windows.
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.


Assisted Solution

Talmash earned 200 total points
ID: 13707414
this line may help you find what is the ascii for any char:

perl -ne '@l=split(//,$_);for $x (@l){print "$x is ".ord($x)."\n";}'

Accepted Solution

jphofmann earned 200 total points
ID: 13710604
As pointed out above, a 'square character' is displayed when the underlying ASCII character is unrecognized. It is worth noting that the 'square character' can represent many different unrecognized characters. More then likely you have a mixture of individual types of characters making up your square characters.

Often these characters have to do with the formatting of text, that when carried over from platform to platform are not displayed correctly.  That being said, you may with to not just delete these characters but replace them with an appropriate counterpart.

http://www.lookuptables.com provides a complete reference of ASCII codes and there character counterparts.  Using this you should be able to determine why they are in your text files.

Author Comment

ID: 13740395
I appreciate the information. It pointed me in the correct direction. Thanks for the help.


Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question