Guys, maybe someone came across a similar. I parse txt files, there are days of the week, and I need to insert a page break before each day of the week (except Monday) and save the files to rtf. How to identify this very gap? Everyone knows " \n " and so on, but what about more specific characters? Thank!

  • you need to set the font to encoding 1251, and transfer the characters \'XX where XX is the hexadecimal code of the character. - nick_n_a
  • Ok, let's say the file was originally in win1251. How to replace it? preg_replace('/вторник|среда|четверг|пятница|суббота|воскресенье/i', "день\XX", $file) ? - forever_young
  • ASCII page break is 0x0C or chr (12) - forever_young
  • In rtf page break \pard; (transfer to a new sheet) and transfer dates (paragraph) \par; (first koment wipe) - nick_n_a
  • one
    I can not give you the answer in php. The answer is what. We write the header (head) rtf {\\rft1\\ansi\\ansicpg1251\\deff0\\deflang1049{ then we write the text, with a replace of characters on those that rtf understands (ie, remove \ {} on screened, \ n -> \\ par; translation of the page -> \\ pard; and Russian characters are better converted into \'ХХ .). Then write the tail }} . Everything. I use the double slash because with ++ and in my opinion php also require doubling the slash, so that it comes out as a slash. - nick_n_a

0