Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Line break character

edited April 2012 in Vanilla 2.0 - 2.8

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

  • x00x00 MVP
    Answer ✓

    what does it say in the Format column?

    grep is your friend.

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.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • 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)

    There was an error rendering this rich post.

  • @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.