Encode::Korean::SKR_1984 - Perl extension for Encoding of Korean: South Korean


Encode-Korean documentation Contained in the Encode-Korean distribution.

Index


Code Index:

NAME

Top

Encode::Korean::SKR_1984 - Perl extension for Encoding of Korean: South Korean Romanization 1984.

SYNOPSIS

Top

  use Encode::Korean::SKR_1984;

  $string = decode 'skr-1984', $octets;
  $octets = encode 'skr-1984', $string;

  while($line = <>) {
    print encode 'utf8', decode 'skr-1984', $line;
  }

DESCRIPTION

Top

Encode::Korean::SKR_1984 implements an encoding system of Korean based on the transliteration method of South Korean romanization system, officially released on January 1, 1984 by South Korean Ministry of Education.

This module use Encode implementation base class Encode::Encoding. The conversion is carried by a transliterator object of Encode::Korean::TransliteratorGenerator (Encode::Korean::TransliteratorGenerator).

RULES RR of Korean is basically similar to McCune-Reischaur, but uses only low ascii characters. In case of ambiguity, orthographic syllable boundaries may be indicated with a hyphen.

	Unicode name		Transliteration

	kiyeok			k (g)
	ssangkieok		kk
	nieun			n
	tikeut			t (d)
	ssangtikeut		tt
	rieul			r
	mieum			m
	pieup			p (b)
	ssangpieup		pp
	sios			s (sh)
	ssangsios		ss
	ieung			ng
	cieuc			ch (j)
	ssangcieuc		tch
	chieuch			ch'
	khieukh			k'
	thieuth			t'
	phieuph			p'
	hieuh			h

	a			a
	ae			ae
	ya			ya
	yae			yae
	eo			\x{014F}		(o with breve)
	e			e
	yeo			y\x{014F}
	ye			ye
	o			o
	wa			wa
	wae			wae
	oe			oe
	yo			yo
	u			u
	weo			wo
	we			we
	wi			wi
	yu			yu
	eu			\x{016D}		(u with breve)
	yi			\x{016D}i
	i			i




SEE ALSO

Top

Visit http://en.wikipedia.org/wiki/Revised_Romanization_of_Korean, if you need information on Revised Romanization of Korean. Keep in mind that this module uses the transliteration method, not the transcription method.

Visit http://www.alanwood.net/unicode/hangul_jamo.html, if you want a list of Hangul Jamo in Unicode.

See Encode, Encode::Encoding, Encode::Korean, Encode::Korean::TransliteratorGenerator (Encode::Korean::TransliteratorGenerator), if you want to know more about relevant modules.

See Encode::KR, Lingua::KO::MacKorean, if you need common encodings.

See Lingua::KO::Romanize::Hangul, if you need a common romanization (transcription method used in public).

AUTHOR

Top

You Hyun Jo, <you at cpan dot org>

COPYRIGHT AND LICENSE

Top


Encode-Korean documentation Contained in the Encode-Korean distribution.

# Encoding of Korean: South Korean Romanization 1984 

# $Id: SKR_1984.pm,v 1.4 2007/11/29 14:25:31 you Exp $

package Encode::Korean::SKR_1984;

our $VERSION = do { q$Revision: 1.4 $ =~ /\d+\.(\d+)/; sprintf "%.2f", $1 / 100  };

use 5.008008;

use strict;
use warnings;

use Encode::Encoding;
use base qw(Encode::Encoding);

__PACKAGE__->Define(qw/skr-1984 skr1984 skr/); 

sub import {
	require Encode;
	Encode->export_to_level(1,@_);
}


# == RULES ==
use Encode::Korean::TransliteratorGenerator;
my $skr = Encode::Korean::TransliteratorGenerator->new();

$skr->consonants(qw(k kk n t tt r m p pp s ss ng ch tch ch' k' t' p' h));
$skr->vowels(
	"a",
	"ae",
	"ya",
	"yae",
	"\x{014F}", # \x{014F} latin small letter o with breve (ŏ)
	"e",
	"y\x{014F}",
	"ye",
	"o",
	"wa",
	"wae",
	"oe",
	"yo",
	"u",
	"wo",
	"we",
	"wi",
	"yu",
	"\x{016D}", # \x{016D} latin small letter u with breve (Å­)
	"\x{016D}y",
	"i"
	);
$skr->el('l');
$skr->ell('ll');
$skr->naught('-');
$skr->sep('-');
$skr->make();


# == MODES ==
$skr->enmode('greedy');
$skr->demode('greedy');
my $encode_enc = 'utf8';
my $decode_enc = 'utf8';

sub enmode {
	my $class = shift;
	my $mode = shift;
	my $enc = shift;
	unless(defined Encode::find_encoding($enc)) {
		require Carp;
		Carp::croak("Unknown encoding '$enc'");
	}

	$skr->enmode($mode);
	$encode_enc = $enc;
}

sub demode {
	my $class = shift;
	my($mode, $enc) = @_;
	$skr->demode($mode);
	$decode_enc = $enc;
}


# == METHODS ==
# === encode ===
# * encode($string [,$check])
# * Encodes unicode hangul syllables (Perl internal string) 
#   into transliterated (romanized) string
sub encode ($$;$) {
    my ($obj, $str, $chk) = @_;
	 my $tr = Encode::encode $encode_enc, $skr->encode($str, $chk);
    $_[1] = '' if $chk;
    return $tr;
}

#
# === decode ===
# * decode($octets [,$check])
# * Decodes transliteration into unicode hangul syllables (Perl internal string)
sub decode ($$;$) {
    my ($obj, $str, $chk) = @_;
	 my $han = $skr->decode(Encode::decode($decode_enc, $str), $chk);
    $_[1] = '' if $chk;
    return $han;
}

# === cat_decode ===
# * Needs to work with encoding pragma
# * cat_decode($destination, $octets, $offset, $terminator [,$check])


1;
__END__