Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9120535
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T05:38:57+00:00 2026-06-17T05:38:57+00:00

How can I induce Term::Readline to set the UTF8 flag one the results from

  • 0

How can I induce Term::Readline to set the UTF8 flag one the results from readline?

#!/usr/local/bin/perl
use warnings FATAL => qw(all);
use strict;
use 5.10.1;
use utf8;
use open qw( :encoding(UTF-8) :std );
use Term::ReadLine;
use Devel::Peek;

my $term = Term::ReadLine->new( 'test', *STDIN, *STDOUT );
$term->ornaments( 0 );
my $char;

$char = $term->readline( 'Enter char: ' );
Dump $char;

print 'Enter char: ';
$char = <>;
chomp $char;
Dump $char;

The output:

Enter char: ü                                                                                                                                                                                 
SV = PV(0x11ce4c0) at 0x1090078
REFCNT = 1
FLAGS = (PADMY,POK,pPOK)
PV = 0x14552c0 "\374"\0
CUR = 1
LEN = 16
Enter char: ü
SV = PV(0x11ce4c0) at 0x1090078
REFCNT = 1
FLAGS = (PADMY,POK,pPOK,UTF8)
PV = 0x14552c0 "\303\274"\0 [UTF8 "\x{fc}"]
CUR = 2
LEN = 16

Comment:

When I am searching in a mysql database (with mysql_enable_utf8 enabled):

my $stmt = "SELECT * FROM $table WHERE City REGEXP ?";
say $stmt;

# my $term = Term::ReadLine->new( 'table_watch', *STDIN, *STDOUT );
# $term->ornaments( 0 ); 
# my $arg = $term->readline( 'Enter argument: ' ); # ü -> doesn't find 'München'

print "Enter argument: ";
my $arg = <>; # ü -> finds 'München'
chomp $arg;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T05:38:59+00:00Added an answer on June 17, 2026 at 5:38 am

    Why? Those two strings are equivalent. It’s like 0 stored as an IV vs stored as a UV.

    Well, it’s possible that you have to deal with buggy XS code. If that’s the case, utf8::upgrade($s) and utf8::downgrade($s) can be used to change how the string is stored in the scalar.

    Unlike encoding and decoding, utf8::upgrade and utf8::downgrade don’t change the string, just how it’s stored.

    $ perl -MDevel::Peek -E'
       $_="\xFC";
       utf8::downgrade($d=$_); Dump($d);
       utf8::upgrade($u=$_);   Dump($u);
       say $d eq $u ?1:0;
    '
    SV = PV(0x86875c) at 0x4a9214
      REFCNT = 1
      FLAGS = (POK,pPOK)
      PV = 0x8699b4 "\374"\0
      CUR = 1
      LEN = 12
    SV = PV(0x868784) at 0x4a8f44
      REFCNT = 1
      FLAGS = (POK,pPOK,UTF8)
      PV = 0x869d14 "\303\274"\0 [UTF8 "\x{fc}"]
      CUR = 2
      LEN = 12
    1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Windows Server 2008. How can I quickly use up RAM so to induce GC
To access the array indice at the xth position we can use some sort
Can I change the field public virtual ClassOne ClassOne { get; set; } to
Can any one tell, how to get the result of LINQ query contains group
http://jsfiddle.net/aam7J/ How would I induce div-like behaviour on the input element? Specifically, how can
I can't seem to read a UDT properly from a stored function with the
I am seeing code like Unload frmMain where from what I can tell frmMain
AFAIK, CFB8 mode has block size of 1byte. So I can induce that IV
I can't use angular $http service for my services. I have to use YQL
Can anyone let me know how can we change the value of kendo combobox

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.