LotR TCG Wiki → Card Sets:  All 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 → Forums:  TLHH CC

Author Topic: Encoding  (Read 363 times)

0 Members and 1 Guest are viewing this topic.

April 19, 2012, 10:51:30 PM
Read 363 times

TelTura

  • *****
  • Information Offline
  • Ranger
  • Administrator
  • Posts: 812
    • Player's Council Discord
Encoding
« on: April 19, 2012, 10:51:30 PM »
So I discovered while copy-pasting that the wiki apparently doesn't have out-of-the-box unicode symbol support, except for their typographical file that handles a few small niceties.   While attempting to paste into The One Ring, The Ruling Ring page with:
Quote
...by The Witch-king, Lord of the Nazgûl or Úlairë Enquëa...

I got the standard HTML garbage:

Quote
...by The Witch-king, Lord of the Nazgûl or Úlairë Enquëa, ...

No, it's not my browser...I can head to doku-wiki's own unicode test page and view the content just fine.  

I'm aware that for the most part, people are just going to use the non-accented versions of card names, and that's fine.  I don't think it needs a huge priority while initially setting up the cards or anything, but I think the official wiki should at least support someone feeling OCD like myself to go through and put all the accents where needed.  I may just be misinterpreting the way to add these symbols, but if not it might be something to consider.


[EDIT:] So I attempted to use the built-in HTML interpreter using <html></html> tags, but according to the styling guide,
Quote
Please Note: HTML and PHP embedding is disabled by default in the configuration. If disabled, the code is displayed instead of executed.

which is exactly what happened.  Funnily enough, the actual files themselves are saved in unicode, as when I saved and reopened the page, the unicode characters were preserved within the edit box.  I've left it as-is for now for the rest of you to see what I see.
« Last Edit: April 19, 2012, 11:06:57 PM by TelTura »
Come join the Player's Council to help us run events, create new cards, and steer the direction of this great game!

Join our Discord here for more information.

April 20, 2012, 06:22:59 AM
Reply #1

Kralik

  • Guest
Re: Encoding
« Reply #1 on: April 20, 2012, 06:22:59 AM »
I'll look into the encoding. One other though though -- for the moment, the wiki isn't well setup to create pages outside of the cards. Navigation isn't there and you'll end up loading something like that CRD page inside of the card page. For now, use an external link (I think there is one, otherwise I'll upload the PDF).

April 20, 2012, 06:44:32 AM
Reply #2

Kralik

  • Guest
Re: Encoding
« Reply #2 on: April 20, 2012, 06:44:32 AM »
Right, here's the deal:

I have code in the Autolinker to convert special UTF-8 characters to HTML. I don't recall the exact reason I needed it there, other than it solved some problem. Maybe something like special quotations for cards like Speak Friend and Enter? Or the various cards with apostrophes (Frodo's Pipe and whatnot) where "fancy" apostrophes were interfering.

Code: [Select]
// Convert UTF-8 to HTML
$text = preg_replace('/([\xc0-\xdf].)/se', "'&#' . ((ord(substr('$1', 0, 1)) - 192) * 64 + (ord(substr('$1', 1, 1)) - 128)) . ';'", $text);
$text = preg_replace('/([\xe0-\xef]..)/se', "'&#' . ((ord(substr('$1', 0, 1)) - 224) * 4096 + (ord(substr('$1', 1, 1)) - 128) * 64 + (ord(substr('$1', 2, 1)) - 128)$

$text = preg_replace("%&#039;|&#8217;%", "'", $text); // Replace apostrophes
$text = preg_replace("%&#8220;|&#8221;%", '"', $text); // Replace quotations

I could certainly remove it, but there's also the point that none of the card titles in the database preserve the accents and the autolinker will miss them as well. Regex is picky and it's not going to match û instead of u, for instance. I used to have some code to strip vowels of accents, but I removed it since it caused issues for non-English speakers on the forums. ;)

EDIT: Removed anyway, since HTML codes won't display on the wiki as intended regardless. You can check 1C2 and see the result...
« Last Edit: April 20, 2012, 06:54:42 AM by Kralik »