Script creates strange names

Discussion in 'PHP' started by deriklogov, Jun 30, 2009.

  1. #1
    Hey , I got php script which creates folders for me , the problem is script adds
    \r symbol to the end of each folder, those names script takes from the text file, so is there any way to open text file to see is there any hidden \r symbols there ?

    Like I know if you just open text file in editor you can not see any hidden symbols like new line \n

    NEED YOUR HELP
     
    deriklogov, Jun 30, 2009 IP
  2. Wrighty

    Wrighty Peon

    Messages:
    199
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    \r is a new line also... it's called a carriage return [I think]

    What you could do is preg_replace these when creating the name, or substr each name before creating it by 2 from the end? :)
     
    Wrighty, Jun 30, 2009 IP
  3. deriklogov

    deriklogov Well-Known Member

    Messages:
    1,080
    Likes Received:
    22
    Best Answers:
    0
    Trophy Points:
    130
    #3
    is that $result=preg_replace('\r','',$source) or I should use some special symbols to describe that \r ?
     
    deriklogov, Jun 30, 2009 IP
  4. Wrighty

    Wrighty Peon

    Messages:
    199
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #4
    That should work fine... :)
    That or you might need to do \\r :)
     
    Wrighty, Jun 30, 2009 IP
  5. GreenWithEnvy

    GreenWithEnvy Active Member

    Messages:
    125
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    53
    #5
    I believe you need to use double quotes when searching for the carriage return.. aka "\r"
     
    GreenWithEnvy, Jun 30, 2009 IP