File: unicode2euc.rb

package info (click to toggle)
libuconv-ruby 0.4.9-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 3,752 kB
  • ctags: 135
  • sloc: ansic: 160,433; xml: 13,060; ruby: 396; makefile: 51
file content (19 lines) | stat: -rw-r--r-- 311 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#! /usr/local/bin/ruby

require 'uconv'
include Uconv

## ̵Ѵʸϥɥ
def Uconv.unknown_unicode_handler(u)
  ##  (GETA MARK) ִ
  return ''
end

line = $<.read
if line =~ /^\xff\xfe/
  print u2toeuc(line)
elsif (line =~ /^\xfe\xff/)
  print u2toeuc(u2swap(line))
else
  print u8toeuc(line)
end