show hidden chars

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

show hidden chars

luke-44
Hi.

I have a file that is used by a GUI to show options in a form.


Example:
filename: 'birds'
/~~~~~
budgie
canary
pigeon
\_____

This file is used to create a drop-down list in a form.
To do this I am using a PHP script.
When a user chooses an option from the drop-down list, that option is then saved
in a database.
The problem is that the database field has a carraige return at the end that
causes all kinds of problems.
The lines in the file have a 'newline' or 'return' at the end that I cannot get
rid of by using 'chop', 'rtrim' or any other php function.
Obviously there is a char at the end of those lines that is not being detected
by the usual means.
So what I am doing is getting rid of the last char by using 'substr'.

However this has the drawback that when a new bird is added by someone with a
different editor the form shows 'goos' instead of goose 'swa' instead of swan
etc.

My Question is (sorry about the long preamble):
How do I get Vim to show the hidden chars?

Thanks in advance.
Kind regards.
Luke.



--
............._..
.|  .| |.|/.|_ .
.|__.|_|.|\.|_ .
:61 421 276 282:
Reply | Threaded
Open this post in threaded view
|

Re: show hidden chars

Thomas-4-2
> The lines in the file have a 'newline' or 'return' at the end that I cannot get
> rid of by using 'chop', 'rtrim' or any other php function.

Maybe it helps to set fileformat to unix when editing the files in vim,
or did I misunderstand the problem?

:h ff

Cheers,
Thomas.

Reply | Threaded
Open this post in threaded view
|

Re: show hidden chars

luke-44
Hi.

06Aug2005 @ 08:56 Thomas thusly spake
> >The lines in the file have a 'newline' or 'return' at the end that I
> >cannot get
> >rid of by using 'chop', 'rtrim' or any other php function.
>
> Maybe it helps to set fileformat to unix when editing the files in vim,
> or did I misunderstand the problem?

I want to *show* the hidden chars.
Thanks for your reply.
Kr.
Luke.

--
............._..
.|  .| |.|/.|_ .
.|__.|_|.|\.|_ .
:61 421 276 282:
Reply | Threaded
Open this post in threaded view
|

Re: show hidden chars

Mark Woodward
[hidden email] said the following on 6/08/2005 5:35 PM:

>Hi.
>
>06Aug2005 @ 08:56 Thomas thusly spake
>  
>
>>>The lines in the file have a 'newline' or 'return' at the end that I
>>>cannot get
>>>rid of by using 'chop', 'rtrim' or any other php function.
>>>      
>>>
>>Maybe it helps to set fileformat to unix when editing the files in vim,
>>or did I misunderstand the problem?
>>    
>>
>
>I want to *show* the hidden chars.
>Thanks for your reply.
>Kr.
>Luke.
>
>  
>
add this (or whatever characters you want spaces/tabs etc to display as)
to your vimrc
see :h lcs

set lcs=tab:>?,trail:-,eol:$,extends:?,precedes:?                      
" set and toggle
nnoremap <leader>shc :set invlist<BAR>set list?<CR>         " hidden
characters

--
Mark