How do I escape a new line character in a .ini file so that Zend_Config_Ini reads it literally?

Posted by Nick on Stack Overflow See other posts from Stack Overflow or by Nick
Published on 2010-03-19T19:35:57Z Indexed on 2010/03/19 19:41 UTC
Read the original article Hit count: 116

Filed under:
|
|
|

I am trying to store a multiple line e-mail in an ini file using PHP/Zend Framework. My string has new lines characters in it, and when I use Zend_Config_Ini to parse the ini file, the new line characters come back escaped, so they are printed out on screen, instead of a line feed.

Example:

// ini file
message = Hi {0},\n\nThis is a test message.\nGoodbye!

is parsed by Zend_Config_Ini as:

Hi {0},\\n\\nThis is a test message.\\nGoodbye!

which then is printed out in the email as:

Hi John,\n\nThis is a test message.\nGoodbye!

Instead I want the e-mail to look like this:

Hi John,

This is a test message.
Goodbye!

Does anybody know how to achieve this? Thanks!

© Stack Overflow or respective owner

Related posts about php

Related posts about ini