News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Help Needed From Character Encoding Expert

Started by j_jindal1, August 01, 2020, 09:31:29 AM

Previous topic - Next topic

j_jindal1

Need expert advice on the issue below...

I'm trying to display SMF posts on wordpress page... For english characters all works well, but things are messed up with non-english characters like regional languages...

See the post on WP page here...

http://shayarfamily.com/test/

Actual post in SMF

https://shayarfamily.com/shayari/love-shayri-in-english-and-other-regional-languages/t224/

P.S. Installation of SMF and WP is on same DB and collation is also same now ("utf8_general_ci"), initially WP tables collation was "utf8mb4_unicode_520_ci" and SMF tables was "utf8_general_ci"

I've already tried...
changing database collation from utf8_general_ci to utf8mb4_unicode_520_ci and vice versa... converting imported post to UTF-8 using encode_utf and decode_utf php functions...

mb_convert_encoding with diff charsets on imported data but results were not good.. :(

Plz help guys....
www.ShayarFamily.com Shayri forum of Friends

j_jindal1

www.ShayarFamily.com Shayri forum of Friends

shawnb61

#2
It looks like your SMF site is properly dealing with UTF8, but your wp site is not. 

You may need to turn to WP support? 

A quick search reveals others have had similar issues.  Some of their suggested solutions look dodgy to me, but then again, I dunno WP:
https://wordpress.stackexchange.com/questions/156626/strange-characters-despite-everything-being-utf-8
https://www.tipsandtricks-hq.com/how-to-fix-the-character-encoding-problem-in-wordpress-1480

Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

j_jindal1

Thanks for your reply.

I'm checking those links if it works... :)
www.ShayarFamily.com Shayri forum of Friends

Arantor

What did you do to get the SMF content into WP exactly?

j_jindal1

Quote from: Arantor on August 04, 2020, 08:26:10 AM
What did you do to get the SMF content into WP exactly?
Thanks for replying, I somewhat fixed it but still need help with other issue.

I was fetching the data using smc functions. This is what I did in an addon php script.

1.  require ("smf_installation/SSI.php");
2.  $smcFunc['db_query']
3.  while ($row = $smcFunc['db_fetch_assoc']($result))

Since the above steps didn't' give correct results, I used $WPDB object of wordpress to fetch data... Now there are no more special characters. But the issue is "data is being printed with BBCODES".

[ size=15pt][ color=brown]अपनी मधहोश निगाहो से सवेरा करना[ /size][ /color]

instead of [ size=15pt][ color=brown] I want appropriate html tags. Could you please guide..
www.ShayarFamily.com Shayri forum of Friends

j_jindal1

Thanks Arantor, Thanks shawnb61 for taking time to reply in this thread. The issue is resolved now.

For anyone else facing similar issue... the solution is fetching the raw data from database and then using parse_bbc function.
www.ShayarFamily.com Shayri forum of Friends

Advertisement: