Sponsored Content
Full Discussion: Where to obtain FreeBSD?
Top Forums UNIX for Dummies Questions & Answers Where to obtain FreeBSD? Post 11154 by treborwallace on Thursday 29th of November 2001 05:04:12 PM
Old 11-29-2001
Wow, that was fast ! Thanks for the advice. I'll give it a try here at work through their T1 connection ! (what the heck, I guess it's work related, just furthering my education).
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

command to obtain lrecl

I'd want to know the command to obtain the lrecl number of a file. (1 Reply)
Discussion started by: leroyj
1 Replies

2. HP-UX

Obtain Memory on HP UNIX

Hi, Does anyone know an easy way of getting the memory usage on a UNIX box? I basically want to find the total % available/in use. Running vmstat gives me 'avm' and 'free' but come in bytes and not percents. Didn't see a switch in sar that just gave me the memory stats similar to Sun's -r... (4 Replies)
Discussion started by: jonesin
4 Replies

3. HP-UX

How can I obtain Hpux?

Hi, How can I obtain Hpux? Thanks (4 Replies)
Discussion started by: arabidi
4 Replies

4. UNIX for Dummies Questions & Answers

How to obtain list of users ?

How to obtain list of users found in /home/ and append it to a file. (7 Replies)
Discussion started by: bobby36
7 Replies

5. Programming

Application crashes in FreeBSD 7.1 while working ok in FreeBSD 6.3

Hello there, My mulithreaded application (which is too large to represent the source code here) is crashing after installing FreeBSD 7.1-RELEASE/amd64. It worked properly on others machines (Dual Cores with 4GB of RAM - FreeBSD 6.2-RELEASE/i386). The current machine has 2x Core 2 Duo... (1 Reply)
Discussion started by: Seenquev
1 Replies

6. Shell Programming and Scripting

Obtain the remote username?

Hi, I'm new to Unix scripting so I'm hoping someone can help me out. I have trawled the web trying to find an answer to this but have not been able to find out anything. I'm trying to create a script that when supplied with a hostname, will find out information about the remote machine. ... (2 Replies)
Discussion started by: Coleyman
2 Replies

7. Programming

to obtain users of each group in c

Hello They have ordered to me that makes several small utilities in C/C++ for the servants, among them a small program in C/C++ to generate a file HTML with the groups of that servant and in addition that is the corresponding users of that group. For example of a group: Group: Sys Members:... (2 Replies)
Discussion started by: cybermeis
2 Replies

8. Shell Programming and Scripting

how to obtain a variable between subroutines

#!/usr/bin/bash sub1 () { for ((i=0;i<10;i++)) do export a=$i; echo "value of a is $a"; sleep 1 done } sub1 & sub2 () { for ((j=0;j<10;j++)) do echo "value of a is $a"; sleep 1 done } (5 Replies)
Discussion started by: Arun_Linux
5 Replies

9. Shell Programming and Scripting

How to obtain info from whois?

Hello, do you know any clever way to get information whether certain domain name become avaialble for registration from bash script? Would be good to check for the availability like every 100miliseconds, i want to catch domain. (1 Reply)
Discussion started by: postcd
1 Replies

10. UNIX for Dummies Questions & Answers

How does IRC obtain the users in a channel?

I'm on an IRC server where the command /names is not a valid command. However, on programs like mIRC and Mibbit, the users in the channel still show up on the GUI where it displays the channel users. What command is being used to obtain the user list? (2 Replies)
Discussion started by: daigo
2 Replies
Encode::Guess(3pm)					 Perl Programmers Reference Guide					Encode::Guess(3pm)

NAME
Encode::Guess -- Guesses encoding from data SYNOPSIS
# if you are sure $data won't contain anything bogus use Encode; use Encode::Guess qw/euc-jp shiftjis 7bit-jis/; my $utf8 = decode("Guess", $data); my $data = encode("Guess", $utf8); # this doesn't work! # more elaborate way use Encode::Guess, my $enc = guess_encoding($data, qw/euc-jp shiftjis 7bit-jis/); ref($enc) or die "Can't guess: $enc"; # trap error this way $utf8 = $enc->decode($data); # or $utf8 = decode($enc->name, $data) ABSTRACT
Encode::Guess enables you to guess in what encoding a given data is encoded, or at least tries to. DESCRIPTION
By default, it checks only ascii, utf8 and UTF-16/32 with BOM. use Encode::Guess; # ascii/utf8/BOMed UTF To use it more practically, you have to give the names of encodings to check (suspects as follows). The name of suspects can either be canonical names or aliases. # tries all major Japanese Encodings as well use Encode::Guess qw/euc-jp shiftjis 7bit-jis/; Encode::Guess->set_suspects You can also change the internal suspects list via "set_suspects" method. use Encode::Guess; Encode::Guess->set_suspects(qw/euc-jp shiftjis 7bit-jis/); Encode::Guess->add_suspects Or you can use "add_suspects" method. The difference is that "set_suspects" flushes the current suspects list while "add_suspects" adds. use Encode::Guess; Encode::Guess->add_suspects(qw/euc-jp shiftjis 7bit-jis/); # now the suspects are euc-jp,shiftjis,7bit-jis, AND # euc-kr,euc-cn, and big5-eten Encode::Guess->add_suspects(qw/euc-kr euc-cn big5-eten/); Encode::decode("Guess" ...) When you are content with suspects list, you can now my $utf8 = Encode::decode("Guess", $data); Encode::Guess->guess($data) But it will croak if Encode::Guess fails to eliminate all other suspects but the right one or no suspect was good. So you should instead try this; my $decoder = Encode::Guess->guess($data); On success, $decoder is an object that is documented in Encode::Encoding. So you can now do this; my $utf8 = $decoder->decode($data); On failure, $decoder now contains an error message so the whole thing would be as follows; my $decoder = Encode::Guess->guess($data); die $decoder unless ref($decoder); my $utf8 = $decoder->decode($data); guess_encoding($data, [, list of suspects]) You can also try "guess_encoding" function which is exported by default. It takes $data to check and it also takes the list of sus- pects by option. The optional suspect list is not reflected to the internal suspects list. my $decoder = guess_encoding($data, qw/euc-jp euc-kr euc-cn/); die $decoder unless ref($decoder); my $utf8 = $decoder->decode($data); # check only ascii and utf8 my $decoder = guess_encoding($data); CAVEATS
o Because of the algorithm used, ISO-8859 series and other single-byte encodings do not work well unless either one of ISO-8859 is the only one suspect (besides ascii and utf8). use Encode::Guess; # perhaps ok my $decoder = guess_encoding($data, 'latin1'); # definitely NOT ok my $decoder = guess_encoding($data, qw/latin1 greek/); The reason is that Encode::Guess guesses encoding by trial and error. It first splits $data into lines and tries to decode the line for each suspect. It keeps it going until all but one encoding was eliminated out of suspects list. ISO-8859 series is just too suc- cessful for most cases (because it fills almost all code points in x00-xff). o Do not mix national standard encodings and the corresponding vendor encodings. # a very bad idea my $decoder = guess_encoding($data, qw/shiftjis MacJapanese cp932/); The reason is that vendor encoding is usually a superset of national standard so it becomes too ambiguous for most cases. o On the other hand, mixing various national standard encodings automagically works unless $data is too short to allow for guessing. # This is ok if $data is long enough my $decoder = guess_encoding($data, qw/euc-cn euc-jp shiftjis 7bit-jis euc-kr big5-eten/); o DO NOT PUT TOO MANY SUSPECTS! Don't you try something like this! my $decoder = guess_encoding($data, Encode->encodings(":all")); It is, after all, just a guess. You should alway be explicit when it comes to encodings. But there are some, especially Japanese, envi- ronment that guess-coding is a must. Use this module with care. TO DO
Encode::Guess does not work on EBCDIC platforms. SEE ALSO
Encode, Encode::Encoding perl v5.8.0 2002-06-01 Encode::Guess(3pm)
All times are GMT -4. The time now is 07:46 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy