Mysterious missing newlines ...

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • dbee

    Mysterious missing newlines ...

    Hi,

    So I'm having a problem with disappearing newlines. I import the
    newlines from a file into my shell script fine. But then I process the
    text and the url_encode comes out the other end with linefeeds intact
    but no newlines.

    Also any single quotes in my file give me a T_STRING unexpected error
    in my output ... even though I'm using rawurlencode(). I've tried
    escaping them in my text but no luck there.
    I can live without the single quotes, but I need newlines in my output.

    URL="`cat job_description `"

    URL_ENCODED_DES CRIPTION=`php -r "echo rawurlencode('$ URL');"`

    .... the single quotes works fine - the php function returns a value -
    so that's not a problem.

    Can anyone help me get a urlencoded string with newlines intact ?
    Otherwise I'm just left with a lump of text.
    Also I can't use <br> or \n in my output because my message board won't
    parse them ... :-)

  • Carl Vondrick

    #2
    Re: Mysterious missing newlines ...

    dbee wrote:[color=blue]
    > Hi,
    >
    > So I'm having a problem with disappearing newlines. I import the
    > newlines from a file into my shell script fine. But then I process the
    > text and the url_encode comes out the other end with linefeeds intact
    > but no newlines.
    >
    > Also any single quotes in my file give me a T_STRING unexpected error
    > in my output ... even though I'm using rawurlencode(). I've tried
    > escaping them in my text but no luck there.
    > I can live without the single quotes, but I need newlines in my output.
    >
    > URL="`cat job_description `"
    >
    > URL_ENCODED_DES CRIPTION=`php -r "echo rawurlencode('$ URL');"`
    >
    > ... the single quotes works fine - the php function returns a value -
    > so that's not a problem.
    >
    > Can anyone help me get a urlencoded string with newlines intact ?
    > Otherwise I'm just left with a lump of text.
    > Also I can't use <br> or \n in my output because my message board won't
    > parse them ... :-)
    >[/color]

    I think I answered something like this before. My suggestion was to
    simply encode newlines using your own method. Make some escape key that
    would act as a newline.

    Carl

    --
    Carl Vondrick
    Professor of Computer Science at Columbia University, researching computer vision, machine learning, and AI applications.

    usenet [at] carlsoft [dot] net

    Comment

    Working...