Fork me on GitHub
Please upgrade to 2.1.x here. The 2.0 branch is no longer being updated.
Important security fix: 2.1.10, released 4 May.

Line break character

edited April 2012 in Vanilla 2.0 Help

What is the recommended line break character for vanilla discussion/comment bodies?

\r, \n, \r\n or what?

I am migrating a custom forum system to Vanilla and line breaks are not converted to "
", despite the fact that I see line breaks in HTML source and PHPMyAdmin edit field.

Best Answer

Answers

  • Well depends, for example if you are using markup it is two spaces at the end of a line or more

  • For some reason Vanilla is not picking up linebreaks from my old forum and not converting them to
    s.

    They are simple linebreaks, straight from a HTML form with only filter being "mysql_real_escape_string()".

    And I can see those linebreaks if i open gdn_discussion table in phpmyadmin. They're there, but not being picked up by Vanilla. If i create new posts in vanilla itself, then I get "correct" linebreaks.

    I tried converting breaks to \r \n \r\n or \n\r, with or without mysql_real_escape_string. Also tried utf8_encode. Nothing works.

    If I replace \n \r \r\n etc. with
    before insering then, of course, I get normal linebreaks. But storing HTML break tags in DB is a no-go.

    Could it be some dreadful encoding issue? Old table used latin1_swedish_ci. Vanilla is utf8_unicode_ci.

  • x00x00 MVP
    Answer ✓

    what does it say in the Format column?

    grep is your friend.

  • @x00

    You just solved my problem!

    I left "Format" column NULL when I wrote my migration script. Now that I set Format to "BBCode" all newlines are picked up as they should!

    So advice for anyone else who is migrating custom forum/commenting system to Vanilla: don't forget "Format" column for gdn_discussion and gdn_comment!!!

    Also, it would be helpful if there was a guide on how to do custom migration (users, password hashing, discussions, comments, user avatars) - otherwise, like me, you have to do it the hard way - by trial and error.

  • zelcs said:

    Also, it would be helpful if there was a guide on how to do custom migration (users, password hashing, discussions, comments, user avatars) - otherwise, like me, you have to do it the hard way - by trial and error.

    start one on the wiki - its sounds like you already know a few things.

  • UnderDogUnderDog Moderator

    zelcs said:
    I left "Format" column NULL when I wrote my migration script. Now that I set Format to "BBCode" all newlines are picked up as they should!

    I think the format we use in our DB tables is 'Html' and not 'BBcode'

    Also, it would be helpful if there was a guide on how to do custom migration (users, password hashing, discussions, comments, user avatars) - otherwise, like me, you have to do it the hard way - by trial and error.

    Do you mean migration from other systems than the one mentioned on the VanillaPorter Addon page? (the one that Vanilla Porter supports)

  • @peregrine

    When I am finished with migration and rebuilding of my site, I think I will write something to contribute to community.

    @UnderDog

    I set it to BBCode because the old system used a subset of BBCode and I hae enabled it on Vanilla configuration as well.

    Regarding migration manual:

    Yes, that is exactly what I mean. Manual on how to populate Garden DB with basic forum data that any custom forum system would have - users, categories, discussions/threads, comments/posts, avatars and password hash issues.

    It wasn't very difficult and I managed to do it just by looking at how vanilla itself populates the tables. But it wasn't without several stumbling blocks - as one can tell by discussions/questions I have posted here.

Sign In or Register to comment.