Our new official repo is on github
LCD Smartie version 5.6 is released!
Download it now: https://github.com/LCD-Smartie/LCDSmartie/releases

Replace chars based on wordlist

Discuss anything to do with plugins

Moderators: _X7JAY7X_, caesar, IFR, mattcro, limbo

Post Reply
Rafael
Plugin Author
Posts: 71
Joined: November 22nd, 2005, 7:12 pm
Location: Curitiba, Paran?, Brazil

Replace chars based on wordlist

Post by Rafael »

Hi There!!

I am trying to develope a plugin that we can change some special chars in a text or a return from some plugin...

This is based in your local coding (In my case: ISO-8859-1)

For example, here we have some words like:

promo??o
avi?o
? vista
d?lar

And then, we have a txt file with the wordlist, it contains:

?|a
?|c
?|o
?|a

The plugin get these lines and put into an Array...

With the str.Replace(?|a) inside the code... we have?

promocao
aviao
a vista
dolar

I have already done a plugin to chance this... Works perfectly with some chars: ?, ?, ?

So when we send: ? or ?, we just have some garbage at LCD!! :x

Is necessary provide some encoding to send from Smartie to Plugin? or Smartie does not supports these kind of chars? :cry:
limbo
Plugin Author
Posts: 1604
Joined: February 13th, 2005, 7:38 pm
Location: Athens - Greece
Contact:

Post by limbo »

Does your LCD supports these characters?
Rafael
Plugin Author
Posts: 71
Joined: November 22nd, 2005, 7:12 pm
Location: Curitiba, Paran?, Brazil

Post by Rafael »

Hi Limbo...

Does not support it... Because this I need to change these chars...

For example, when I send a word:

$dll(SuperTroca,1,ISO8859-1,S?bado)

it returns

Sabado (perfectly to LCD)

When I need to return it from a function

$dll(SuperTroca,1,ISO8859-1,$dll(SomeDLL,1,??,??))

it returns

S(garbage)bado

:cry:
limbo
Plugin Author
Posts: 1604
Joined: February 13th, 2005, 7:38 pm
Location: Athens - Greece
Contact:

Post by limbo »

try to use "search and replace" plugin to achieve it by replacing characters with custom ones!
mattcro
Forum Supporter
Posts: 590
Joined: March 8th, 2006, 1:58 pm
Location: Scotland

Post by mattcro »

Hey Rafael, I would use a plugin like this! I have MP3s with European accented characters. For example, "Sigur R?s - S?gl?pur" does not display correctly on the LCD (I have the Japanese character set). It could be converted to "Sigur Ros - Saeglopur".

I guess it is basically the same function as sandr.dll, but the config file is arranged a bit differently.

I tried using sandr.dll, but there are not enough slots to cater for all the character variations. I ended up putting a hard-coded character replacer in my serial backpack firmware to do this, but it would be nice to have it under software control so I can change the search/replace table if necessary.

It would be tricky to use custom chars to display the accented characters, since there may be more than 8 different accented chars on screen at a time (admittedly unlikely) plus some custom chars for graphs/spectrum or play/pause/stop etc symbols.

I have also noticed that some plugins (not all) do not handle some extended/accented characters properly, and a couple of garbage characters are shown in place of a single accented character. I think this may be caused by the plugins converting input strings/characters to unicode or similar multibyte strings. The plain C++ plugins like ReverseEngineer's do not affect the characters, but some (maybe .NET, VB, C#) cause strange output. I guess it really depends what string/char types and functions you use. As far as I know, Smartie itself does not affect the characters like this.

Matt.
Rafael
Plugin Author
Posts: 71
Joined: November 22nd, 2005, 7:12 pm
Location: Curitiba, Paran?, Brazil

Post by Rafael »

Hi Matt!!!

Here is the plugin:
http://www.freewebs.com/rafaelcamacho/SuperTroca.dll

Database (put in the same plugin directory with the same name Banco.txt):
http://www.freewebs.com/rafaelcamacho/Banco.txt


The only problem is with the return of some functions... :cry:

I am trying to discover a way to encoding to your regional settings what my function need receive from smartie....

Usage:

$dll(SuperTroca,1,coding,word or function return)

Example:

Coding: ISO-8859-1 (Brazilian Charset to load Banco.txt)
Function on Smartie: $Time(dddd) <- In LCD, this returns terqa-feira, and is wrong!!

$dll(SuperTroca,1,ISO-8859-1,$Time(dddd)) <- in LCD we will have: terca-feira :D based in Banco.txt

The right word is: ter?a-feira
The wrong word in LCD: terqa-feira
The adaptation to LCD: terca-feira (HD44780 do not supports the letter ?)

:D
Andrew
Posts: 20
Joined: April 27th, 2009, 4:17 pm

Post by Andrew »

Rafael wrote: The only problem is with the return of some functions... :cry:
Any progress with that? I have the same problem with my own plugins. :/

EDIT:
So here's what I've noticed:

plugin1 as a parameter has $WinampTitle, according to the byte tables for few encodings I've noticed that it returns a string in ASCII, the plugin2 retrieves from plugin1 an ASCII string according to its byte table for ASCII (I've checked it before it returned something).
Post Reply