Thread Problem mit putty (6 answers)
Opened by tomskicat at 2013-04-20 14:32

Raubtier
 2013-04-20 16:09
#167175 #167175
User since
2012-05-04
1057 Artikel
BenutzerIn

user image
Keine Ahnung was in deinen Terminals unterschiedlich ist. Aber was macht das use encoding ':locale' in deinem Script? Wozu hast du das drin?

Wenn alles (terminal/script) in utf8 ist, geht es auch ohne. Sonst kannst du mit use utf8; sagen, dass dein Script in utf8 geschrieben ist und dann kannst du alle Ausgaben mit encode("gewünsche Ausgabekodierung", $deinString);" in die gewünsche Kodierung bringen, ggf. wieder utf8. (encode(...) aus Perldoc:Encode)

Aus dem entsprechenden perldoc:
Quote
# switch on locale -
# note that this probably means that unless you have a complete control
# over the environments the application is ever going to be run, you should
# NOT use the feature of encoding pragma allowing you to write your script
# in any recognized encoding because changing locale settings will wreck
# the script; you can of course still use the other features of the pragma.
use encoding ':locale';


Vielleicht abschließend noch 2 weitere Bemerkungen:
1. "abschliessen" -> wird mit ß geschrieben (es sei denn, du bist Schweizer)

2. if ($name =~ /^\s$/) -> überall fragst du mit /^\s$ ab, ob ein String leer ist. Warum nicht mit /^$/ - das $ matcht auch vor einem Newline. Dein \s erlaubt z.B. ein Leerzeichen oder ein Tab als gültige Eingabe.

3. Deine Einrückung ist gewöhnungsbedürftig.
Last edited: 2013-04-20 16:20:01 +0200 (CEST)

View full thread Problem mit putty