Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 02-02-2009, 12:28 PM   #1
Registered: Jan 2004
Location: Los Angeles
Distribution: Slack64 14.1
Posts: 581

Rep: Reputation: 38
Perl and MultiByte Characters


I have a software package, that when it writes files, where the name contains accented or umlaut characters, it converts those characters to multi byte in the filename.

I have written a small Perl script, just to validate that the files exist on disk, based on a list of files contained in a text document The file names in this document have the correct accented or umlaut characters. This script fails on all the files that contain these characters. I think it's because I need to convert these characters to multi byte, to match how they have been named on disk.

However, if I attach the drive to my Windows system then my Perl script works, so I'm assuming that the underlying OS calls on Windows is doing this translation for me.

But, that isn't a complete solution, because Windows is case insensitive, whereas I need my script to be case sensitive.

So, is there any way to force Perl to convert strings, containing these characters, into multi byte, similar to WideCharToMultiByte in Windows C.

Old 02-02-2009, 03:43 PM   #2
Registered: Sep 2007
Location: Berlin
Distribution: Slackware
Posts: 510

Rep: Reputation: 53
Perl is Unicode-capable - if you enable it. Read man

perluniintro Perl Unicode introduction
perlunicode Perl Unicode support
perlunifaq Perl Unicode FAQ
perlunitut Perl Unicode tutorial

for details.

Case sensitivity can easily be enabled within Perl where and when you need it - for example within regular expressions.

And Windows uses a different Unicode encoding (UTF-16) than Linux/Unix (UTF-8), bear this in mind.

You'll have to tell Perl which one when to use.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Perl] Transforming non-printable characters. ////// Programming 3 04-04-2007 05:51 PM
display in hex + perl + non ASCII characters kshkid Programming 4 02-06-2007 05:48 PM
using perl to insert special characters into mysql database ihopeto Programming 5 12-25-2006 05:08 PM
Convert characters to hex values in perl pjz Programming 3 12-08-2005 09:35 AM
extracting first n characters of a string in perl ananthbv Programming 4 09-14-2004 08:25 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:47 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration