Moin liebe Leute,
ich sitze noch immer an meinem ersten eigenen Modul.
Leider hapert es zur Zeit mit der Darstellung / Behandlung der Sonderzeichen.
Auf meinem Produktivsystem habe ich den Quellcode von meinem Modul intern in der 99_myUtils.
Der Code ist zu 95% identisch, auch die Sonderzeichen sind vorhanden.
Hier möchte ich gerne einen Notify anlegen mit einem "festen" Text.
Der notify wird angelegt, jedoch wird das "ü" nicht richtig dargestellt.
...
elsif ($preis > 0)
{ fhem "define n_pvg_$name notify pvg_$name:.* \{ if (\$EVTPART1 < $preis and \$EVTPART1 > 0) \{ fhem \"set $dev1 message \\\@$id Dein Preiswecker für $name1 ($preis EUR) hat angeschlagen!\\nDer aktuelle Bestpreis liegt zur Zeit bei \$EVTPART1 EUR! \\nHier ist der Link zum Preisvergleich:\\n$link\" \} \} ; attr n_pvg_$name room Preisvergleich ; setreading n_pvg_$name Preiswecker $preis";
fhem "set $dev1 message \@$id Dein Preiswecker ($preis EUR) für:\n$name1\nwurde erfolgreich gestartet.";
}
...
Hier ein List (TESTSYSTEM) von einem Notify, welches durch den oberen define angelegt wurde:
Internals:
DEF pvg_Apple_iPhone_Xr_850.00_Mathze:.* { if ($EVTPART1 < 850.00 and $EVTPART1 > 0) { fhem "set Telegram message \@282202771 Dein Preiswecker f�r Apple iPhone Xr (850.00 EUR) hat angeschlagen!\nDer aktuelle Bestpreis liegt zur Zeit bei $EVTPART1 EUR! \nHier ist der Link zum Preisvergleich:\nhttps://www.idealo.de/preisvergleich/OffersOfProduct/6299100_-iphone-xr-apple.html" } }
NAME n_pvg_Apple_iPhone_Xr_850.00_Mathze
NOTIFYDEV pvg_Apple_iPhone_Xr_850.00_Mathze
NR 26
NTFY_ORDER 50-n_pvg_Apple_iPhone_Xr_850.00_Mathze
REGEXP pvg_Apple_iPhone_Xr_850.00_Mathze:.*
STATE active
TYPE notify
READINGS:
2018-09-20 09:25:09 Preiswecker 850.00
2018-09-20 13:04:02 state active
Attributes:
room Preisvergleich
Und hier ein List (PRODUKTIVSYSTEM) von einem Notify, diesmal aber direkt aus der 99_myUtils:
Internals:
DEF pvg_Apple_iPhone_7_32GB_schwarz_400.00_Mathze:.* { if ($EVTPART1 < 400.00 and $EVTPART1 > 0) { fhem "set Telegram message @282202771 Dein Preiswecker für Apple iPhone 7 32GB schwarz (400.00 EUR) hat angeschlagen!\nDer aktuelle Bestpreis liegt zur Zeit bei $EVTPART1 EUR! \nHier ist der Link zum Preisvergleich:\nhttps://www.idealo.de/preisvergleich/OffersOfProduct/5972779_-860-evo-1tb-2-5-samsung.html" } }
NAME n_pvg_Apple_iPhone_7_32GB_schwarz_400.00_Mathze
NOTIFYDEV pvg_Apple_iPhone_7_32GB_schwarz_400.00_Mathze
NR 775
NTFY_ORDER 50-n_pvg_Apple_iPhone_7_32GB_schwarz_400.00_Mathze
REGEXP pvg_Apple_iPhone_7_32GB_schwarz_400.00_Mathze:.*
STATE active
TYPE notify
READINGS:
2018-09-14 13:25:44 Preiswecker 400.00
2018-09-20 10:55:15 state active
Attributes:
DbLogExclude .*
room Preisvergleich
Hier klappt die Darstellung des Sonderzeichens einwandfrei!
Muss ich hier noch irgendwas "Encoden" oder "Decoden"?
Ich habe versucht mich ein bisschen in das Thema einzulesen, jedoch trete ich auf der Stelle und weiß nicht mehr so recht, was ich ausprobieren soll.
@gelöst:
Hatte falsche Pakete eingebunden gehabt!
Gruß
Mathze
Auf welches Encoding ist der Editor eingestellt ?
http://findencoding.com/
LG
pah
Ich nutze Notepad++ und habe unter dem Reiter Encoding folgende ausprobiert:
Encode in UTF-8 without BOM
&
Encode in UTF-8
&
Encode in ANSI
Wenn ich es in ANSI lasse, bekomme ich beim "reload 40_checkPVG.pm" folgende Warnings im Log:
2018.09.20 10:54:37 1: PERL WARNING: Malformed UTF-8 character (unexpected non-continuation byte 0x73, immediately after start byte 0xf6) at ./FHEM/40_checkPVG.pm line 100, <$fh> line 41.
2018.09.20 10:54:37 1: PERL WARNING: Malformed UTF-8 character (unexpected non-continuation byte 0x6e, immediately after start byte 0xc4) at ./FHEM/40_checkPVG.pm line 101, <$fh> line 41.
2018.09.20 10:54:37 1: PERL WARNING: Malformed UTF-8 character (unexpected non-continuation byte 0x73, immediately after start byte 0xf6) at ./FHEM/40_checkPVG.pm line 107, <$fh> line 41.
2018.09.20 10:54:37 1: PERL WARNING: Malformed UTF-8 character (unexpected non-continuation byte 0x6e, immediately after start byte 0xc4) at ./FHEM/40_checkPVG.pm line 108, <$fh> line 41.
2018.09.20 10:54:37 1: PERL WARNING: Malformed UTF-8 character (unexpected continuation byte 0x80, with no preceding start byte) at ./FHEM/40_checkPVG.pm line 146, <$fh> line 41.
2018.09.20 10:54:37 1: PERL WARNING: Malformed UTF-8 character (1 byte, need 3, after start byte 0xe4) at ./FHEM/40_checkPVG.pm line 202, <$fh> line 41.
2018.09.20 10:54:37 1: PERL WARNING: Malformed UTF-8 character (1 byte, need 2, after start byte 0xc4) at ./FHEM/40_checkPVG.pm line 203, <$fh> line 41.
2018.09.20 10:54:37 1: PERL WARNING: Malformed UTF-8 character (1 byte, need 4, after start byte 0xf6) at ./FHEM/40_checkPVG.pm line 204, <$fh> line 41.
2018.09.20 10:54:37 1: PERL WARNING: Malformed UTF-8 character (1 byte, need 2, after start byte 0xd6) at ./FHEM/40_checkPVG.pm line 205, <$fh> line 41.
2018.09.20 10:54:37 1: PERL WARNING: Malformed UTF-8 character (1 byte, need 6, after start byte 0xfc) at ./FHEM/40_checkPVG.pm line 206, <$fh> line 41.
2018.09.20 10:54:37 1: PERL WARNING: Malformed UTF-8 character (1 byte, need 2, after start byte 0xdc) at ./FHEM/40_checkPVG.pm line 207, <$fh> line 41.
2018.09.20 10:54:37 1: PERL WARNING: Malformed UTF-8 character (1 byte, need 2, after start byte 0xdf) at ./FHEM/40_checkPVG.pm line 208, <$fh> line 41.
2018.09.20 10:54:37 1: PERL WARNING: Malformed UTF-8 character (unexpected non-continuation byte 0x6e, immediately after start byte 0xe4) at ./FHEM/40_checkPVG.pm line 215, <$fh> line 41.
Wenn ich auf UTF-8 umstelle, dann bleiben die Warnings weg, aber die Sonderzeichen sind weiterhin nicht so, wie ich sie mir vorstellen.
Meine 99_myUtils programmiere ich auch in Notepad++, kopiere dann den Inhalt in das FHEM Frontend rein und speichere es im FHEM Frontend.
Gruß
Mathze