Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^4: help with cyrillic characters in odd places

by Anonymous Monk
on Feb 17, 2019 at 07:28 UTC ( [id://1230020]=note: print w/replies, xml ) Need Help??


in reply to Re^3: help with cyrillic characters in odd places
in thread help with cyrillic characters in odd places

Hmm, no, that was wrong, use open qw/:std :utf8/; use open OUT => ':encoding(UTF-8)', ':std'; alone doesn't cause Mojibake on my system (instead, I get proper UTF-8 output). Something else is going on.

Replies are listed 'Best First'.
Re^5: help with cyrillic characters in odd places
by Aldebaran (Curate) on Feb 20, 2019 at 07:41 UTC
    Something else is going on.

    I've just tried to avoid that something else as I kept cutting out parts that weren't working, especially with caller, and moved as much of the html stuff out of it as I could.

    I went all the way to hard-coding the paths. There's only two for right now.

    # crossword params
    my %vars = (
    
      cw          => path( $path2, 'crosswords' ),
      изображение => path( $path2, 'crosswords', 'изображение', "1.атаман.jpg" ),
      подписи     => path( $path2, 'crosswords', 'подписи', "1.кгосс.txt" ),
    
    );
    
    if ( $vars{изображение}->is_file ) {
      say "We have a path to the image";
    }
    
    my $rvars           = \%vars;
    my $ref_html_values = init_values( $title, $path2, $abs );
    my %html_vars       = %$ref_html_values;
    
    # append returned hash from init
    @vars{ keys %html_vars } = values %html_vars;

    If the following is init_values(), do I combine the hashes in a robust way?

    I'm able to get the captions inputed, and the output makes sense with a few different views to it:

    This is with the following sub:

    sub make_russian_crossword { use 5.011; use warnings; use POSIX qw(strftime); use Path::Tiny; use Encode; use open OUT => ':encoding(UTF-8)', ':std'; use Data::Dumper; use utf8; my $rvars = shift; my %vars = %$rvars; my $munge = strftime( "p%d-%m-%Y-%H-%M-%S\.txt", localtime ); my $in_path = path( $vars{rus_captions}, $munge )->touchpath; say "in make russian xword------"; ##Let mother know that you created a file, *verb* a reference: $vars{log_file} = $in_path; ## input use Path::Tiny methods my @lines = $vars{подписи} +->lines_utf8; say "lines are @lines"; my $ref_lines = \@lines; vars{data} = $ref_lines; say "with Dumper------"; say Dumper $ref_lines; say "with Dump------"; use Data::Dump; dd $ref_lines; #print_aoa_utf8($ref_lines); say "using slurp method--------"; my $guts = $vars{подписи}- +>slurp_utf8; say "guts are $guts"; my $width = 10; ## trim off white space beyond ten for every line # trim leading or trailing whitespace return $rvars; }

    Where I'm at is looking for ways to get these data rectangular. In particular, I want to trim the lines to length ten and trim leading and trailing whitespace.

    It seems like something that perl would do elegantly.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1230020]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (5)
As of 2024-03-29 14:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found