JPTRANS: Converting Japanese Specific Characters

How to:

Reference:

The JPTRANS function converts Japanese specific characters.

Syntax: How to Convert Japanese Specific Characters

JPTRANS ('type_of_conversion', length, source_string, 'output_format')

where:

type_of_conversion

Is one of the following options indicating the type of conversion you want to apply to Japanese specific characters. The following table shows the single component input types:

Conversion Type

Description

'UPCASE'

Converts Zenkaku (Fullwidth) alphabets to Zenkaku uppercase.

'LOCASE' 

Converts Zenkaku alphabets to Zenkaku lowercase.

'HNZNALPHA'

Converts alphanumerics from Hankaku (Halfwidth) to Zenkaku.

'HNZNSIGN' 

Converts ASCII symbols from Hankaku to Zenkaku.

'HNZNKANA'

Converts Katakana from Hankaku to Zenkaku.

'HNZNSPACE' 

Converts space (blank) from Hankaku to Zenkaku.

'ZNHNALPHA'

Converts alphanumerics from Zenkaku to Hankaku.

'ZNHNSIGN' 

Converts ASCII symbols from Zenkaku to Hankaku.

'ZNHNKANA'

Converts Katakana from Zenkaku to Hankaku.

'ZNHNSPACE' 

Converts space from Zenkaku to Hankaku.

'HIRAKATA'

Converts Hiragana to Zenkaku Katakana.

'KATAHIRA'

Converts Zenkaku Katakana to Hiragana.

'930TO939' 

Converts codepage from 930 to 939.

'939TO930' 

Converts codepage from 939 to 930.

length

Integer

Is the number of characters in the source_string.

source_string

Alphanumeric

Is the string to convert.

output_format

Alphanumeric

Is the name of the field that contains the output, or the format enclosed in single quotation marks (').

Example: Using the JPTRANS Function

JPTRANS('UPCASE', 20, Alpha_DBCS_Field, 'A20')
JPTRANS('LOCASE', 20, Alpha_DBCS_Field, 'A20')
JPTRANS('HNZNALPHA', 20, Alpha_SBCS_Field, 'A20')
JPTRANS('HNZNSIGN', 20, Symbol_SBCS_Field, 'A20')
JPTRANS('HNZNKANA', 20, Hankaku_Katakana_Field, 'A20')
JPTRANS('HNZNSPACE', 20, Hankaku_Katakana_Field, 'A20')
JPTRANS('ZNHNALPHA', 20, Alpha_DBCS_Field, 'A20')
JPTRANS('ZNHNSIGN', 20, Symbol_DBCS_Field, 'A20')
JPTRANS('ZNHNKANA', 20, Zenkaku_Katakana_Field, 'A20')
JPTRANS('ZNHNSPACE', 20, Zenkaku_Katakana_Field, 'A20')
JPTRANS('HIRAKATA', 20, Hiragana_Field, 'A20')
JPTRANS('KATAHIRA', 20, Zenkaku_Katakana_Field, 'A20')

In the following, codepoints 0x62 0x63 0x64 are converted to 0x81 0x82 0x83, respectively:

JPTRANS('930TO939', 20, CP930_Field, 'A20')

In the following, codepoints 0x59 0x62 0x63 are converted to 0x81 0x82 0x83, respectively:

JPTRANS('939TO930', 20, CP939_Field, 'A20')

Reference: Usage Notes for the JPTRANS Function

  • HNZNSIGN and ZNHNSIGN focus on the conversion of symbols.

    Many symbols have a one-to-one relation between Japanese Fullwidth characters and ASCII symbols, whereas some characters have one-to-many relations. For example, the Japanese punctuation character (U+3001) and Fullwidth comma , (U+FF0C) will be converted to the same comma , (U+002C). The following EXTRA rule for those special cases is shown below:

    HNZNSIGN:

    • Double Quote " (U+0022) -> Fullwidth Right Double Quote ” (U+201D)
    • Single Quote ' (U+0027) -> Fullwidth Right Single Quote ’ (U+2019)
    • Comma , (U+002C) -> Fullwidth Ideographic Comma (U+3001)
    • Full Stop . (U+002E) -> Fullwidth Ideographic Full Stop ? (U+3002)
    • Backslash \ (U+005C) -> Fullwidth Backslash \ (U+FF3C)
    • Halfwidth Left Corner Bracket (U+FF62) -> Fullwidth Left Corner Bracket (U+300C)
    • Halfwidth Right Corner Bracket (U+FF63) -> Fullwidth Right Corner Bracket (U+300D)
    • Halfwidth Katakana Middle Dot ? (U+FF65) -> Fullwidth Middle Dot · (U+30FB)

    ZNHNSIGN:

    • Fullwidth Right Double Quote ” (U+201D) -> Double Quote " (U+0022)
    • Fullwidth Left Double Quote “ (U+201C) -> Double Quote " (U+0022)
    • Fullwidth Quotation " (U+FF02) -> Double Quote " (U+0022)
    • Fullwidth Right Single Quote ’ (U+2019) -> Single Quote ' (U+0027)
    • Fullwidth Left Single Quote ‘ (U+2018) -> Single Quote ' (U+0027)
    • Fullwidth Single Quote ' (U+FF07) -> Single Quote ' (U+0027)
    • Fullwidth Ideographic Comma (U+3001) -> Comma , (U+002C)
    • Fullwidth Comma , (U+FF0C) -> Comma , (U+002C)
    • Fullwidth Ideographic Full Stop ? (U+3002) -> Full Stop . (U+002E)
    • Fullwidth Full Stop . (U+FF0E) -> Full Stop . (U+002E)
    • Fullwidth Yen Sign ¥ (U+FFE5) -> Yen Sign ¥ (U+00A5)
    • Fullwidth Backslash \ (U+FF3C) -> Backslash \ (U+005C)
    • Fullwidth Left Corner Bracket (U+300C) -> Halfwidth Left Corner Bracket (U+FF62)
    • Fullwidth Right Corner Bracket (U+300D) -> Halfwidth Right Corner Bracket (U+FF63)
    • Fullwidth Middle Dot · (U+30FB) -> Halfwidth Katakana Middle Dot · (U+FF65)
  • HNZNKANA and ZNHNKANA focus on the conversion of Katakana

    They convert not only letters, but also punctuation symbols on the following list:

    • Fullwidth Ideographic Comma (U+3001) <-> Halfwidth Ideographic Comma (U+FF64)
    • Fullwidth Ideographic Full Stop (U+3002) <-> Halfwidth Ideographic Full Stop (U+FF61)
    • Fullwidth Left Corner Bracket (U+300C) <-> Halfwidth Left Corner Bracket (U+FF62)
    • Fullwidth Right Corner Bracket (U+300D) <-> Halfwidth Right Corner Bracket (U+FF63)
    • Fullwidth Middle Dot · (U+30FB) <-> Halfwidth Katakana Middle Dot · (U+FF65)
    • Fullwidth Prolonged Sound (U+30FC) <-> Halfwidth Prolonged Sound (U+FF70)
  • JPTRANS can be nested for multiple conversions.

    For example, text data may contain fullwidth numbers and fullwidth symbols. In some situations, they should be cleaned up for ASCII numbers and symbols.

    JPTRANS('ZNHNALPHA', 20, JPTRANS('ZNHNSIGN', 20, Symbol_DBCS_Field, 'A20'), 'A20')
  • HNZNSPACE and ZNHNSPACE focus on the conversion of a space (blank character).

    Currently only conversion between U+0020 and U+3000 is supported.