• Home
Name Date Size #Lines LOC

..--

.settings/12-May-2024-383380

src/com/ibm/icu/dev/tool/currency/12-May-2024-898758

.classpathD12-May-2024299 76

.projectD12-May-2024375 1817

build.xmlD12-May-20243.2 KiB7959

readme.txtD12-May-20244.3 KiB12485

readme.txt

1*******************************************************************************
2* © 2016 and later: Unicode, Inc. and others.
3* License & terms of use: http://www.unicode.org/copyright.html
4*******************************************************************************
5* Copyright (C) 2012-2013, International Business Machines Corporation and    *
6* others. All Rights Reserved.                                                *
7*******************************************************************************
8
9[Overview]
10
11This directory contains a tool used for maintaining ICU's ISO 4217 currency
12code mapping data. ICU uses a resource generated by this tool for mapping
13ISO 4217 currency alpha codes to numeric codes.
14
15
16[Files]
17
18package com.ibm.icu.dev.tool.currency
19
20Main.java - The tool's entry point
21NumericCodeData.java - The mapping data used by ICU
22CurrencyDataParser.java - ISO 4217 XML data parser
23CurrencyDataEntry.java - ISO 4217 XML data entry
24
25
26[Details]
27
28com.ibm.icu.dev.tool.NumericCodeData has String[][] CODE_MAP_DATA.
29This array represents mappings between ISO 4217 alpha codes and
30numeric codes. ICU's resource bundle currencyNumericCodes is generated
31from the table.
32
33ISO 4217 maintenance agency - SIX Interbank Clearing distributes
34ISO 4217 code data in XML format. These files are found in
35http://www.currency-iso.org/iso_index/iso_tables.htm. There are two
36files that we're interested in.
37
38 - https://www.six-group.com/dam/download/financial-information/data-center/iso-currrency/lists/list-one.xml
39 - https://www.six-group.com/dam/download/financial-information/data-center/iso-currrency/lists/list-three.xml
40
41Table A.1 contains current currencies and funds and Table A.3 contains
42historic denominations.
43
44The tool supports 2 commands - check / resource.
45
461) check
47
48This command compares the hardcoded mapping data in NumericCodeData.java
49with the ISO 4217 XML data files side by side and check differences.
50
512) resource
52
53This command writes out the hardcoded mapping data in NumericCodeData.java
54in ICU resource bundle source format - currencyNumericCodes.txt.
55
56
57[Release Tasks]
58
59For each ICU release, we should check if the mapping data is up to date.
60
61Prerequisites: Java 6+, ant
62
63First, run the ant target "check". This ant target download XML files from
64the SIX Interbank Clearing site and invoke the tool command "check".
65
66When the target successfully finished, you should see the log like below:
67----------------------------------------------------------------------------
68C:\devtools\trunk\currency>ant
69Buildfile: C:\devtools\trunk\currency\build.xml
70
71classes:
72
73_checkLocalXml:
74
75_localXml:
76
77_downloadXml:
78     [echo] Downloading ISO 4217 XML data files
79      [get] Getting: http://www.currency-iso.org/dam/downloads/lists/list_one.xm
80l
81      [get] To: C:\devtools\trunk\currency\out\xml\list_one.xml
82      [get] Getting: http://www.currency-iso.org/dam/downloads/lists/list_three.
83xml
84      [get] To: C:\devtools\trunk\currency\out\xml\list_three.xml
85
86xmlData:
87
88check:
89     [java] [OK] ICU data is synchronized with the reference data
90
91resource:
92     [echo] ISO 4217 numeric code mapping data was successfully created in C:\de
93vtools\trunk\currency/out/res
94
95build:
96
97BUILD SUCCESSFUL
98Total time: 1 second
99----------------------------------------------------------------------------
100In this case, our data is synchronized with the latest XML data and you're done.
101
102
103If the data is out of sync, you should see message like below:
104----------------------------------------------------------------------------
105check:
106     [java] Missing alpha code in ICU map [ZWR]
107     [java] Codes not found in the reference data: ZZZ
108
109BUILD FAILED
110C:\devtools\trunk\currency\build.xml:54: Java returned: 1
111----------------------------------------------------------------------------
112In this case, you have to update the hardcoded data in NumericCodeData.
113You can either edit the table in NumericCodeData manually, or run the tool
114command "print" and copy the output and paste it to the table.
115
116Once you make sure "ant check" returns no errors, run "ant resource". This
117target generate out/res/currencyNumericCodes.txt. The file should go to
118<icu4c>/source/data/misc directory.
119
120Note: The default ant target does both operation. Although it creates the
121ICU resource file, you do not need to replace the one in ICU4C package with
122the newly generated one if "check" successfully finished.
123
124