Sunday, April 21, 2013

Polish and Hungarian to HTML character converter

As some of you may already know, I'm maintaining www.lengyel13.hu, a website that has mixed, Polish and Hungarian text. Both of these languages use special characters and as such, when you add them to a website, you will have to use their ASCII equivalent in your HTML code, otherwise some browsers might not interpret them correctly. For long time I have done this change to the original text manually in HTML using the find and replace function of my HTML editor, however this took a considerate amount of my valuable time, and I was sure there has to be another way, so I came up with this idea: why don't I create a Polish and Hungarian to HTML character converter myself?

I made some searches on the net, found the php function that replaces characters, found the question answered on stackoverflow.com about multiple replacements (Search and replace multiple values with multiple/different values in PHP5?), so I only needed to format it a little, and this the result, hope you'll like it!

Polish and Hungarian to HTML character converter / Konwerter polskich i węgierskich znaków na encje HTML / Lengyel és magyar HTML karakter konverter

EDITED: I keep referring to HTML characters in my post but yes, obviously we're talking about ASCII characters to be very precise. I use HTML as I believe it's usually easier to understand for most people.

2 comments:

  1. To convert Polish and Hungarian text to HTML character one must requires to convert Hungarian character to ASCII character and then it will converted into HTML text.

    ReplyDelete
  2. @Nistha adhikari: well, yes, you're 100% correct. The only reason I'm using HTML instead of ASCII is because I think people would understand it easier. I have however now added this info to the bottom of my post, in reaction to your note.

    ReplyDelete

Dear legitimate commenters, please post your comments below. I'd be happy to receive your feedback; helps me a lot improving, or getting reassurance that I'm doing something really great here.

IMPORTANT! A note to commenters planning on advertising their business in comments: please be informed that I'm NOT going to post your comments but will ALWAYS mark them as SPAM.