Non-printable chars in filenames: how do you get rid of them?

Non-printable chars in filenames: how do you get rid of them?

Post by Wim Cossemen » Fri, 25 Nov 2005 21:09:52



Hello,

I've got a small issue here with weird characters in filenames on a UFS
(at least that's what I think, how do you check this, since mount does
not realy list the filetype) disk Solaris 9

I suspect they were put there via Samba from a Windows machine, and that
the actual character is an or an .

When I ls it displays C??cile, wich is probably Cclile or so, and ls -b
gives me this C\303\251cile.

ls C\303\251cile gives an error...

But how do I manipulate such a file or directory?
Does UFS also works with inodes like ext2?

I could try to get rid of it thru the Windows box, but I'd reallt like a
command line option since I want to run some scripts lateron...

Regards,

Wimmy
--
+----------+
|  PLEASE  |
|  DO NOT  |
| FEED THE |
|  TROLLS  |
+----------+
     |  |
     |  |
   .\|.||/..

 
 
 

Non-printable chars in filenames: how do you get rid of them?

Post by Chris Rid » Fri, 25 Nov 2005 21:48:23




> Hello,

> I've got a small issue here with weird characters in filenames on a UFS
> (at least that's what I think, how do you check this, since mount does
> not realy list the filetype) disk Solaris 9

Try 'mount -v'.

Quote:> I suspect they were put there via Samba from a Windows machine, and that
> the actual character is an or an .

> When I ls it displays C??cile, wich is probably Cclile or so, and ls -b
> gives me this C\303\251cile.

> ls C\303\251cile gives an error...

> But how do I manipulate such a file or directory?
> Does UFS also works with inodes like ext2?

Oddly enough, yes.

I would use 'ls -i' to get the file's inode, and 'find . -inum blah -exec rm
{} \;' to remove it.

Cheers,

Chris

 
 
 

Non-printable chars in filenames: how do you get rid of them?

Post by Wim Cossemen » Fri, 25 Nov 2005 22:19:41



>>But how do I manipulate such a file or directory?
>>Does UFS also works with inodes like ext2?

> Oddly enough, yes.

> I would use 'ls -i' to get the file's inode, and 'find . -inum blah -exec rm
> {} \;' to remove it.

Aha, well, I figured something like that but since I found nothing about
inodes in the ls manpage I did not try.

So I used this find . -inum -exec with move to rename the dir, but is
there another way to do this? I mean to give the inode number directly
to another command?

Thanks,

Wimmy

 
 
 

Non-printable chars in filenames: how do you get rid of them?

Post by Andreas Prilo » Fri, 25 Nov 2005 23:17:19



> I've got a small issue here with weird characters in filenames on a UFS
> (at least that's what I think, how do you check this, since mount does
> not realy list the filetype) disk Solaris 9

> When I ls it displays C??cile, wich is probably Cclile or so, and ls -b
> gives me this C\303\251cile.

0303 = 0xC3 and 0251 = 0xA9
These are not actually non-printable characters in ISO-8859-1.
They are "?" and "?", resp. Apparently you have set your locale to C.

0xC3A9 is "" in UTF-8 encoding. Therefore you should set
  LANG=en.UTF-8
  LC_ALL=en.UTF-8
or some other locale with UTF-8 encoding.

Anyway, it it always a good idea to use only ASCII characters
in file names.

--
Netscape 3.04 does everything I need, and it's utterly reliable.

 
 
 

Non-printable chars in filenames: how do you get rid of them?

Post by Wim Cossemen » Sat, 26 Nov 2005 01:04:50



> 0303 = 0xC3 and 0251 = 0xA9
> These are not actually non-printable characters in ISO-8859-1.
> They are "?" and "?", resp. Apparently you have set your locale to C.

> 0xC3A9 is "" in UTF-8 encoding. Therefore you should set
>   LANG=en.UTF-8
>   LC_ALL=en.UTF-8
> or some other locale with UTF-8 encoding.

> Anyway, it it always a good idea to use only ASCII characters
> in file names.

I'll give it a go!

Wimmy

 
 
 

Non-printable chars in filenames: how do you get rid of them?

Post by Colin B » Sat, 26 Nov 2005 03:41:16



> Hello,

> I've got a small issue here with weird characters in filenames on a UFS
> (at least that's what I think, how do you check this, since mount does
> not realy list the filetype) disk Solaris 9

#fstyp <device path>
 
 
 

Non-printable chars in filenames: how do you get rid of them?

Post by Robert Gruene » Wed, 30 Nov 2005 19:39:25



> Hello,

> I've got a small issue here with weird characters in filenames on a UFS
> (at least that's what I think, how do you check this, since mount does
> not realy list the filetype) disk Solaris 9

> I suspect they were put there via Samba from a Windows machine, and that
> the actual character is an or an .

> When I ls it displays C??cile, wich is probably Cclile or so, and ls -b
> gives me this C\303\251cile.

> ls C\303\251cile gives an error...

> But how do I manipulate such a file or directory?
> Does UFS also works with inodes like ext2?

> I could try to get rid of it thru the Windows box, but I'd reallt like a
> command line option since I want to run some scripts lateron...

> Regards,

> Wimmy

Just to get rid of it

ls *cile > xx.sh
Then open xx.sh with vi or ex and edit a "mv" to the beginning of the
line and a Cecile to the end.
sh xx.sh  and the odd filename is renamed to Cecile.
Regards

Robert

--

Gruss

Robert

 
 
 

Non-printable chars in filenames: how do you get rid of them?

Post by David Com » Sun, 25 Dec 2005 12:02:50





>>>But how do I manipulate such a file or directory?
>>>Does UFS also works with inodes like ext2?

>> Oddly enough, yes.

>> I would use 'ls -i' to get the file's inode, and 'find . -inum blah -exec rm
>> {} \;' to remove it.

>Aha, well, I figured something like that but since I found nothing about
>inodes in the ls manpage I did not try.

>So I used this find . -inum -exec with move to rename the dir, but is
>there another way to do this? I mean to give the inode number directly
>to another command?

>Thanks,

>Wimmy

Unless I misunderstand the problem, one easy way to delete funnily-named
files is via emacs, via its "dired" command, on the directory the
funny-file is *in*.

It shows you a "ls -l"-style dir listing; you just cursor or search
down to the line showing that file, and hit "d" (for "delete"),
then hit "x", and it then shows you all the files there that
are marked "d", and asks if you're sure you want to delete them,
and if you answer "yes" -- bingo, they're gone.

Works just as long as you can at least *recognize* the printing-part
of the funny-name.

Hope this helps!

David

PS: Oh, want to learn emacs?  Once installed, just run it, then
type in "C-H C-T" (control-h, control-t -- "t" for "tutorial") (written
by RMS himself), and just read along and do what it says.

EASY!

Good luck!

 
 
 

1. HOWTO filter single non-printable chars with a sequence of printable chars

Hi,

The context of this problem is: some mailers on Windows insert CP1252
encoded characters in mails but set charset=iso-8859-1. I use mutt on
Linux, which can filter mails before displaying them, so it's just a
question of defining a filter command line. The problematic CP1252
characters are: left/right single/double quotes, and em/en dashes. A
one-to-one mapping seemed to suffice for these, so I used tr. Now I
bumped into the horizontal ellipsis, octal 205 under CP1252, which I
think should be translated to '...'. This is where I got stuck.

I came up with this filter:

awk 'index("\205", $0) { gsub("\205", "...") } { print }'

but it feels like an overkill to filter every single mail through tr,
for the one-to-one mappings, and then awk, for the one-to-many
mappings.

Would anybody have a suggestion of a cleaner, more idiomatic way of
accomplishing this ?

Thanks for the patience in reading this
Paulo

2. a crash -sort of

3. Print line with non-printable chars

4. qmain install problems..

5. raw char * buffer to char * printable string conversion issue

6. peer to peer proggies and connection tracking

7. Need to know what non-printable characters are inside a VI session

8. fbdev: sleeping function called from illegal context

9. how to reference non-printable characters?

10. Set IFS to non-printable character

11. How do I print the "non-printable" characters in a C Shell script?

12. vi - how do i insert non-printable characters/codes with no keyboard location?

13. non-printable characters - deleting