Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

java.util.Currency

1,297 views
Skip to first unread message

Roedy Green

unread,
Apr 24, 2002, 2:19:31 AM4/24/02
to
I am somewhat disappointed by this class:

1. the getSymbol just repeats getCurrencyCode. It does not give you
the unicode symbol except for Canada $

2. Locale.getAllISOCountries for which there is no corresponding
Currency defined.

3. There is no way to get the name of the currency in English e.g.
"Israeli New Shekel"

4. There is no provision for currency conversion.


I did discover that the names of the countries change depending on
your locale language. It is part of Locale rather than Currency,
though.

--
The answers to most Java questions are in the
Java glossary indexed and cross-indexed by keyword.
It is usually faster to look them up there than ask
here and wait for a response. See:
http://www.mindprod.com/jgloss.html
or http://209.139.205.39/jagg.html

-
eagerly seeking telecommuting programming work.
canadian mind products, roedy green

Roedy Green

unread,
Apr 24, 2002, 3:19:57 AM4/24/02
to
On Wed, 24 Apr 2002 06:19:31 GMT, Roedy Green <ro...@mindprod.com>
wrote or quoted :

>I am somewhat disappointed by this class:
>
>1. the getSymbol just repeats getCurrencyCode. It does not give you
>the unicode symbol except for Canada $
>
>2. Locale.getAllISOCountries for which there is no corresponding
>Currency defined.
>
>3. There is no way to get the name of the currency in English e.g.
>"Israeli New Shekel"
>
>4. There is no provision for currency conversion.
>
>
>I did discover that the names of the countries change depending on
>your locale language. It is part of Locale rather than Currency,
>though.

One other related problem, Locale is missing the names for dozens of
countries and the currencies for some too.

The names and two-letter codes can be had from a table at
http://mindprod.com/domains.html

Here is a table of country codes, countries, currencies, currency
decimal and currency names.

The table includes the countries listed on the www.oanda.com exchange.
Perhaps a dozen countries are not.


"ad","Andorra","EUR","2","Euro"
"ae","United Arab Emirates","AED","2","Utd. Arab Emir. Dirham"
"af","Afghanistan","AFA","2","Afghanistan Afghani"
"ai","Anguilla","XCD","2","East Caribbean Dollar"
"al","Albania","ALL","2","Albanian Lek"
"an","Netherlands Antilles","ANG","2","NL Antillian Guilder"
"ao","Angola","AON","2","Angolan New Kwanza"
"ar","Argentina","ARS","2","Argentine Peso"
"as","American Samoa","USD","2","US Dollar"
"at","Austria","EUR","2","Euro"
"au","Australia","AUD","2","Australian Dollar"
"aw","Aruba","AWG","2","Aruban Florin"
"bb","Barbados","BBD","2","Barbados Dollar"
"bd","Bangladesh","BDT","2","Bangladeshi Taka"
"be","Belgium","EUR","2","Euro"
"bf","Burkina Faso","XOF","0","CFA Franc BCEAO"
"bg","Bulgaria","BGL","2","Bulgarian Lev"
"bh","Bahrain","BHD","2","Bahraini Dinar"
"bi","Burundi","BIF","0","Burundi Franc"
"bj","Benin","XOF","0","CFA Franc BCEAO"
"bm","Bermuda","BMD","2","Bermudian Dollar"
"bn","Brunei","BND","2","Brunei Dollar"
"bo","Bolivia","BOB","2","Bolivian Boliviano"
"br","Brazil","BRL","2","Brazilian Real"
"bs","Bahamas","BSD","2","Bahamanian Dollar"
"bt","Bhutan","BTN","2","Bhutan Ngultrum"
"bv","BV","NOK","2","Norwegian Kroner"
"bw","Botswana","BWP","2","Botswana Pula"
"bz","Belize","BZD","2","Belize Dollar"
"ca","Canada","CAD","2","Canadian Dollar"
"cc","Cocos (Keeling) Islands","AUD","2","Australian Dollar"
"cf","Central African Republic","XAF","0","CFA Franc BEAC"
"cg","Congo","XAF","0","CFA Franc BEAC"
"ch","Switzerland","CHF","2","Swiss Franc"
"ci","Côte d'Ivoire","XOF","0","CFA Franc BCEAO"
"ck","Cook Islands","NZD","2","New Zealand Dollar"
"cl","Chile","CLP","0","Chilean Peso"
"cm","Cameroon","XAF","0","CFA Franc BEAC"
"cn","China","CNY","2","Chinese Yuan Renminbi"
"co","Colombia","COP","2","Colombian Peso"
"cr","Costa Rica","CRC","2","Costa Rican Colon"
"cu","Cuba","CUP","2","Cuban Peso"
"cv","Cape Verde","CVE","2","Cape Verde Escudo"
"cx","Christmas island","AUD","2","Australian Dollar"
"cy","Cyprus","CYP","2","Cyprus Pound"
"cz","Czech Republic","CSK","2","Czech Koruna"
"de","Germany","EUR","2","Euro"
"dj","Djibouti","DJF","0","Djibouti Franc"
"dk","Denmark","DKK","2","Danish Krone"
"dm","Dominica","XCD","2","East Caribbean Dollar"
"do","Dominican Republic","DOP","2","Dominican R. Peso"
"dz","Algeria","DZD","2","Algerian Dinar"
"ec","Ecuador","USD","2","US Dollar"
"ee","Estonia","EEK","2","Estonian Kroon"
"eg","Egypt","EGP","2","Egyptian Pound"
"eh","Western Sahara","MAD","2","Moroccan Dirham"
"es","Spain","EUR","2","Euro"
"et","Ethiopia","ETB","2","Ethiopian Birr"
"fi","Finland","EUR","2","Euro"
"fj","Fiji","FJD","2","Fiji Dollar"
"fk","Falkland Islands","FKP","2","Falkland Islands Pound"
"fm","Micronesia","USD","2","US Dollar"
"fo","Faroe islands","DKK","2","Danish Krone"
"fr","France","EUR","2","Euro"
"ga","Gabon","XAF","0","CFA Franc BEAC"
"gb","United Kingdom","GBP","2","British Pound"
"gd","Grenada","XCD","2","East Caribbean Dollar"
"gf","French Guiana","EUR","2","Euro"
"gh","Ghana","GHC","2","Ghanaian Cedi"
"gi","Gibraltar","GIP","2","Gibraltar Pound"
"gl","Greenland","DKK","2","Danish Krone"
"gm","Gambia","GMD","2","Gambian Dalasi"
"gn","Guinea","GNF","0","Guinea Franc"
"gp","Guadeloupe","EUR","2","Euro"
"gq","Equatorial Guinea","XAF","0","CFA Franc BEAC"
"gr","Greece","EUR","2","Euro"
"gs","South Georgia","GBP","2","British Pound"
"gt","Guatemala","GTQ","2","Guatemalan Quetzal"
"gu","Guam","USD","2","US Dollar"
"gy","Guyana","GYD","2","Guyanese Dollar"
"hk","Hong Kong","HKD","2","Hong Kong Dollar"
"hm","Heard and McDonald Islands","AUD","2","Australian Dollar"
"hn","Honduras","HNL","2","Honduran Lempira"
"hr","Croatia","HRK","2","Croatian Kuna"
"ht","Haiti","HTG","2","Haitian Gourde"
"hu","Hungary","HUF","2","Hungarian Forint"
"id","Indonesia","IDR","2","Indonesian Rupiah"
"ie","Ireland","EUR","2","Euro"
"il","Israel","ILS","2","Israeli New Shekel"
"in","India","INR","2","Indian Rupee"
"io","British Indian Ocean Territory","USD","2","US Dollar"
"iq","Iraq","IQD","2","Iraqi Dinar"
"ir","Iran","IRR","2","Iranian Rial"
"is","Iceland","ISK","2","Iceland Krona"
"it","Italy","EUR","2","Euro"
"jm","Jamaica","JMD","2","Jamaican Dollar"
"jo","Jordan","JOD","2","Jordanian Dinar"
"jp","Japan","JPY","0","Japanese Yen"
"ke","Kenya","KES","2","Kenyan Shilling"
"kh","Cambodia","KHR","2","Cambodian Riel"
"ki","Kiribati","AUD","2","Australian Dollar"
"km","Comoros","KMF","0","Comoros Franc"
"kn","Saint Kitts and Nevis","XCD","2","East Caribbean Dollar"
"kp","North Korea","KPW","2","North Korean Won"
"kr","South Korea","KRW","0","South-Korean Won"
"kw","Kuwait","KWD","2","Kuwaiti Dinar"
"ky","Cayman Islands","KYD","2","Cayman Islands Dollar"
"kz","Kazakhstan","KZT","2","Kazakhstan Tenge"
"la","Laos","LAK","2","Lao Kip"
"lb","Lebanon","LBP","2","Lebanese Pound"
"lc","Saint Lucia","XCD","2","East Caribbean Dollar"
"li","Liechtenstein","CHF","2","Swiss Franc"
"lk","Sri Lanka","LKR","2","Sri Lanka Rupee"
"lr","Liberia","LRD","2","Liberian Dollar"
"ls","Lesotho","LSL","2","Lesotho Loti"
"lt","Lithuania","LTL","2","Lithuanian Litas"
"lu","Luxembourg","EUR","2","Euro"
"lv","Latvia","LVL","2","Latvian Lats"
"ly","Libya","LYD","2","Libyan Dinar"
"ma","Morocco","MAD","2","Moroccan Dirham"
"mc","Monaco","EUR","2","Euro"
"mg","Madagascar","MGF","0","Malagasy Franc"
"mh","Marshall Islands","USD","2","US Dollar"
"ml","Mali","XOF","0","CFA Franc BCEAO"
"mm","Myanmar","MMK","2","Myanmar Kyat"
"mn","Mongolia","MNT","2","Mongolian Tugrik"
"mo","Macau","MOP","2","Macau Pataca"
"mp","Northern Mariana Islands","USD","2","US Dollar"
"mq","Martinique","EUR","2","Euro"
"mr","Mauritania","MRO","2","Mauritanian Ouguiya"
"ms","Montserrat","XCD","2","East Caribbean Dollar"
"mt","Malta","MTL","2","Maltese Lira"
"mu","Mauritius","MUR","2","Mauritius Rupee"
"mv","Maldives","MVR","2","Maldive Rufiyaa"
"mw","Malawi","MWK","2","Malawi Kwacha"
"mx","Mexico","MXP","2","Mexican Peso"
"my","Malaysia","MYR","2","Malaysian Ringgit"
"mz","Mozambique","MZM","2","Mozambique Metical"
"na","Namibia","NAD","2","Namibia Dollar"
"ne","Niger","XOF","0","CFA Franc BCEAO"
"nf","Norfolk Island","AUD","2","Australian Dollar"
"ng","Nigeria","NGN","2","Nigerian Naira"
"ni","Nicaragua","NIO","2","Nicaraguan Cordoba Oro"
"nl","Netherlands","EUR","2","Euro"
"no","Norway","NOK","2","Norwegian Kroner"
"np","Nepal","NPR","2","Nepalese Rupee"
"nr","Nauru","AUD","2","Australian Dollar"
"nu","Niue","NZD","2","New Zealand Dollar"
"nz","New Zealand","NZD","2","New Zealand Dollar"
"om","Oman","OMR","2","Omani Rial"
"pa","Panama","PAB","2","Panamanian Balboa"
"pe","Peru","PEN","2","Peruvian Nuevo Sol"
"pg","Papua New Guinea","PGK","2","Papua New Guinea Kina"
"ph","Philippines","PHP","2","Philippine Peso"
"pk","Pakistan","PKR","2","Pakistan Rupee"
"pl","Poland","PLZ","2","Polish Zloty"
"pm","St. Pierre and Miquelon","EUR","2","Euro"
"pn","Pitcairn","NZD","2","New Zealand Dollar"
"pr","Puerto Rico","USD","2","US Dollar"
"pt","Portugal","EUR","2","Euro"
"pw","Palau","USD","2","US Dollar"
"py","Paraguay","PYG","0","Paraguay Guarani"
"qa","Qatar","QAR","2","Qatari Rial"
"re","Reunion","EUR","2","Euro"
"ro","Romania","ROL","2","Romanian Leu"
"ru","Russia","RUB","2","Russian Rouble"
"sa","Saudi Arabia","SAR","2","Saudi Riyal"
"sb","Solomon Islands","SBD","2","Solomon Islands Dollar"
"sc","Seychelles","SCR","2","Seychelles Rupee"
"sd","Sudan","SDD","2","Sudanese Dinar"
"se","Sweden","SEK","2","Swedish Krona"
"sg","Singapore","SGD","2","Singapore Dollar"
"sh","St. Helena","SHP","2","St. Helena Pound"
"si","Slovenia","SIT","2","Slovenian Tolar"
"sj","Svalbard and Jan Mayen Islands","NOK","2","Norwegian Kroner"
"sk","Slovakia","SKK","2","Slovak Koruna"
"sl","Sierra Leone","SLL","2","Sierra Leone Leone"
"sm","San Marino","EUR","2","Euro"
"sn","Senegal","XOF","0","CFA Franc BCEAO"
"so","Somalia","SOS","2","Somali Shilling"
"sr","Suriname","SRG","2","Suriname Guilder"
"st","Sao Tome and Principe","STD","2","Sao Tome/Principe Dobra"
"sv","El Salvador","SVC","2","El Salvador Colon"
"sy","Syria","SYP","2","Syrian Pound"
"sz","Swaziland","SZL","2","Swaziland Lilangeni"
"tc","Turks and Caicos Islands","USD","2","US Dollar"
"td","Chad","XAF","0","CFA Franc BEAC"
"tf","French Southern Territories","EUR","2","Euro"
"tg","Togo","XOF","0","CFA Franc BCEAO"
"th","Thailand","THB","2","Thai Baht"
"tk","Tokelau","NZD","2","New Zealand Dollar"
"tn","Tunisia","TND","2","Tunisian Dinar"
"to","Tonga","TOP","2","Tonga Pa'anga"
"tr","Turkey","TRL","0","Turkish Lira"
"tt","Trinidad and Tobago","TTD","2","Trinidad/Tobago Dollar"
"tv","Tuvalu","AUD","2","Australian Dollar"
"tw","Taiwan","TWD","2","Taiwan Dollar"
"tz","Tanzania","TZS","2","Tanzanian Shilling"
"ua","Ukraine","UAH","2","Ukraine Hryvnia"
"ug","Uganda","UGS","2","Uganda Shilling"
"um","United States minor outlying islands","USD","2","US Dollar"
"us","United States","USD","2","US Dollar"
"uy","Uruguay","UYP","2","Uruguayan Peso"
"va","Vatican","EUR","2","Euro"
"vc","Saint Vincent and the Grenadines","XCD","2","East Caribbean
Dollar"
"ve","Venezuela","VEB","2","Venezuelan Bolivar"
"vg","British Virgin Islands","USD","2","US Dollar"
"vi","U.S. Virgin Islands","USD","2","US Dollar"
"vn","Vietnam","VND","2","Vietnamese Dong"
"vu","Vanuatu","VUV","0","Vanuatu Vatu"
"ye","Yemen","YER","2","Yemeni Rial"
"yt","Mayotte","EUR","2","Euro"
"yu","Yugoslavia","YUN","2","Yugoslav Dinar"
"za","South Africa","ZAR","2","South African Rand"
"zm","Zambia","ZMK","2","Zambian Kwacha"
"zw","Zimbabwe","ZWD","2","Zimbabwe Dollar"

John O'Conner

unread,
Apr 24, 2002, 12:41:57 PM4/24/02
to

"Roedy Green" <ro...@mindprod.com> wrote in message
news:tmhccu8458hnq5v3h...@4ax.com...

> I am somewhat disappointed by this class:
>
> 1. the getSymbol just repeats getCurrencyCode. It does not give you
> the unicode symbol except for Canada $
>
> 2. Locale.getAllISOCountries for which there is no corresponding
> Currency defined.
>
> 3. There is no way to get the name of the currency in English e.g.
> "Israeli New Shekel"
>
> 4. There is no provision for currency conversion.
>
>


Does this help at all?
http://www.javai18n.com/articles/CurrencyUpdate.html

Regards,
John O'Conner

Roedy Green

unread,
Apr 24, 2002, 6:25:27 PM4/24/02
to
On Wed, 24 Apr 2002 07:19:57 GMT, Roedy Green <ro...@mindprod.com>
wrote or quoted :

>


>The table includes the countries listed on the www.oanda.com exchange.
>Perhaps a dozen countries are not.

I have done my best to add currency symbols to the table. If you see
any errors, please let me know. Perhaps we can get this table in
shape for sun to use in their Currency class which right now does not
properly provide the symbols.

ad,Andorra,EUR,\u20ac,2,Euro,
ae,"United Arab Emirates",AED,\u00a4,2,"Utd. Arab Emir. Dirham",
af,Afghanistan,AFA,\u00a4,2,"Afghanistan Afghani",
ai,Anguilla,XCD,$,2,"East Caribbean Dollar",
al,Albania,ALL,\u00a4,2,"Albanian Lek",
an,"Netherlands Antilles",ANG,\u00a4,2,"NL Antillian Guilder",
ao,Angola,AON,\u00a4,2,"Angolan New Kwanza",
ar,Argentina,ARS,\u20b1,2,"Argentine Peso",
as,"American Samoa",USD,$,2,"US Dollar",
at,Austria,EUR,\u20ac,2,Euro,
au,Australia,AUD,$,2,"Australian Dollar",
aw,Aruba,AWG,\u00a4,2,"Aruban Florin",
bb,Barbados,BBD,$,2,"Barbados Dollar",
bd,Bangladesh,BDT,\u00a4,2,"Bangladeshi Taka",
be,Belgium,EUR,\u20ac,2,Euro,
bf,"Burkina Faso",XOF,\u20a3,0,"CFA Franc BCEAO",
bg,Bulgaria,BGL,\u00a4,2,"Bulgarian Lev",
bh,Bahrain,BHD,\u00a4,2,"Bahraini Dinar",
bi,Burundi,BIF,\u20a3,0,"Burundi Franc",
bj,Benin,XOF,\u20a3,0,"CFA Franc BCEAO",
bm,Bermuda,BMD,$,2,"Bermudian Dollar",
bn,Brunei,BND,$,2,"Brunei Dollar",
bo,Bolivia,BOB,\u00a4,2,"Bolivian Boliviano",
br,Brazil,BRL,\u20a2,2,"Brazilian Real",
bs,Bahamas,BSD,$,2,"Bahamanian Dollar",
bt,Bhutan,BTN,\u00a4,2,"Bhutan Ngultrum",
bv,BV,NOK,\u00a4,2,"Norwegian Kroner",
bw,Botswana,BWP,\u00a4,2,"Botswana Pula",
bz,Belize,BZD,$,2,"Belize Dollar",
ca,Canada,CAD,$,2,"Canadian Dollar",
cc,"Cocos (Keeling) Islands",AUD,$,2,"Australian Dollar",
cf,"Central African Republic",XAF,\u20a3,0,"CFA Franc BEAC",
cg,Congo,XAF,\u20a3,0,"CFA Franc BEAC",
ch,Switzerland,CHF,\u20a3,2,"Swiss Franc",
ci,"Côte d'Ivoire",XOF,\u20a3,0,"CFA Franc BCEAO",
ck,"Cook Islands",NZD,$,2,"New Zealand Dollar",
cl,Chile,CLP,\u20b1,0,"Chilean Peso",
cm,Cameroon,XAF,\u20a3,0,"CFA Franc BEAC",
cn,China,CNY,\u00a4,2,"Chinese Yuan Renminbi",
co,Colombia,COP,\u20b1,2,"Colombian Peso",
cr,"Costa Rica",CRC,\u20a1,2,"Costa Rican Colon",
cu,Cuba,CUP,\u20b1,2,"Cuban Peso",
cv,"Cape Verde",CVE,\u00a4,2,"Cape Verde Escudo",
cx,"Christmas island",AUD,$,2,"Australian Dollar",
cy,Cyprus,CYP,\u00a4,2,"Cyprus Pound",
cz,"Czech Republic",CSK,\u00a4,2,"Czech Koruna",
de,Germany,EUR,\u20ac,2,Euro,
dj,Djibouti,DJF,\u20a3,0,"Djibouti Franc",
dk,Denmark,DKK,\u00a4,2,"Danish Krone",
dm,Dominica,XCD,$,2,"East Caribbean Dollar",
do,"Dominican Republic",DOP,\u20b1,2,"Dominican R. Peso",
dz,Algeria,DZD,\u00a4,2,"Algerian Dinar",
ec,Ecuador,USD,$,2,"US Dollar",
ee,Estonia,EEK,\u00a4,2,"Estonian Kroon",
eg,Egypt,EGP,\u00a4,2,"Egyptian Pound",
eh,"Western Sahara",MAD,\u00a4,2,"Moroccan Dirham",
es,Spain,EUR,\u20ac,2,Euro,
et,Ethiopia,ETB,\u00a4,2,"Ethiopian Birr",
fi,Finland,EUR,\u20ac,2,Euro,
fj,Fiji,FJD,$,2,"Fiji Dollar",
fk,"Falkland Islands",FKP,\u00a4,2,"Falkland Islands Pound",
fm,Micronesia,USD,$,2,"US Dollar",
fo,"Faroe islands",DKK,\u00a4,2,"Danish Krone",
fr,France,EUR,\u20ac,2,Euro,
ga,Gabon,XAF,\u20a3,0,"CFA Franc BEAC",
gb,"United Kingdom",GBP,\u00a4,2,"British Pound",
gd,Grenada,XCD,$,2,"East Caribbean Dollar",
gf,"French Guiana",EUR,\u20ac,2,Euro,
gh,Ghana,GHC,\u00a4,2,"Ghanaian Cedi",
gi,Gibraltar,GIP,\u00a4,2,"Gibraltar Pound",
gl,Greenland,DKK,\u00a4,2,"Danish Krone",
gm,Gambia,GMD,\u00a4,2,"Gambian Dalasi",
gn,Guinea,GNF,\u20a3,0,"Guinea Franc",
gp,Guadeloupe,EUR,\u20ac,2,Euro,
gq,"Equatorial Guinea",XAF,\u20a3,0,"CFA Franc BEAC",
gr,Greece,EUR,\u20ac,2,Euro,
gs,"South Georgia",GBP,\u00a4,2,"British Pound",
gt,Guatemala,GTQ,\u00a4,2,"Guatemalan Quetzal",
gu,Guam,USD,$,2,"US Dollar",
gy,Guyana,GYD,$,2,"Guyanese Dollar",
hk,"Hong Kong",HKD,$,2,"Hong Kong Dollar",
hm,"Heard and McDonald Islands",AUD,$,2,"Australian Dollar",
hn,Honduras,HNL,\u00a4,2,"Honduran Lempira",
hr,Croatia,HRK,\u00a4,2,"Croatian Kuna",
ht,Haiti,HTG,\u00a4,2,"Haitian Gourde",
hu,Hungary,HUF,\u00a4,2,"Hungarian Forint",
id,Indonesia,IDR,\u00a4,2,"Indonesian Rupiah",
ie,Ireland,EUR,\u20ac,2,Euro,
il,Israel,ILS,\u20aa,2,"Israeli New Shekel",
in,India,INR,\u20a8,2,"Indian Rupee",
io,"British Indian Ocean Territory",USD,$,2,"US Dollar",
iq,Iraq,IQD,\u00a4,2,"Iraqi Dinar",
ir,Iran,IRR,\ufdfc,2,"Iranian Rial",
is,Iceland,ISK,\u00a4,2,"Iceland Krona",
it,Italy,EUR,\u20ac,2,Euro,
jm,Jamaica,JMD,$,2,"Jamaican Dollar",
jo,Jordan,JOD,\u00a4,2,"Jordanian Dinar",
jp,Japan,JPY,\u00a5,0,"Japanese Yen",
ke,Kenya,KES,\u00a4,2,"Kenyan Shilling",
kh,Cambodia,KHR,\u17db,2,"Cambodian Riel",
ki,Kiribati,AUD,$,2,"Australian Dollar",
km,Comoros,KMF,\u20a3,0,"Comoros Franc",
kn,"Saint Kitts and Nevis",XCD,$,2,"East Caribbean Dollar",
kp,"North Korea",KPW,\u20a9,2,"North Korean Won",
kr,"South Korea",KRW,\u20a9,0,"South-Korean Won",
kw,Kuwait,KWD,\u00a4,2,"Kuwaiti Dinar",
ky,"Cayman Islands",KYD,$,2,"Cayman Islands Dollar",
kz,Kazakhstan,KZT,\u00a4,2,"Kazakhstan Tenge",
la,Laos,LAK,\u20ad,2,"Lao Kip",
lb,Lebanon,LBP,\u00a4,2,"Lebanese Pound",
lc,"Saint Lucia",XCD,$,2,"East Caribbean Dollar",
li,Liechtenstein,CHF,\u20a3,2,"Swiss Franc",
lk,"Sri Lanka",LKR,\u00a4,2,"Sri Lanka Rupee",
lr,Liberia,LRD,$,2,"Liberian Dollar",
ls,Lesotho,LSL,\u00a4,2,"Lesotho Loti",
lt,Lithuania,LTL,\u00a4,2,"Lithuanian Litas",
lu,Luxembourg,EUR,\u20ac,2,Euro,
lv,Latvia,LVL,\u00a4,2,"Latvian Lats",
ly,Libya,LYD,\u00a4,2,"Libyan Dinar",
ma,Morocco,MAD,\u00a4,2,"Moroccan Dirham",
mc,Monaco,EUR,\u20ac,2,Euro,
mg,Madagascar,MGF,\u20a3,0,"Malagasy Franc",
mh,"Marshall Islands",USD,$,2,"US Dollar",
ml,Mali,XOF,\u20a3,0,"CFA Franc BCEAO",
mm,Myanmar,MMK,\u00a4,2,"Myanmar Kyat",
mn,Mongolia,MNT,\u20ad,2,"Mongolian Tugrik",
mo,Macau,MOP,\u00a4,2,"Macau Pataca",
mp,"Northern Mariana Islands",USD,$,2,"US Dollar",
mq,Martinique,EUR,\u20ac,2,Euro,
mr,Mauritania,MRO,\u00a4,2,"Mauritanian Ouguiya",
ms,Montserrat,XCD,$,2,"East Caribbean Dollar",
mt,Malta,MTL,\u20a4,2,"Maltese Lira",
mu,Mauritius,MUR,\u00a4,2,"Mauritius Rupee",
mv,Maldives,MVR,\u00a4,2,"Maldive Rufiyaa",
mw,Malawi,MWK,\u00a4,2,"Malawi Kwacha",
mx,Mexico,MXP,\u20b1,2,"Mexican Peso",
my,Malaysia,MYR,\u00a4,2,"Malaysian Ringgit",
mz,Mozambique,MZM,\u00a4,2,"Mozambique Metical",
na,Namibia,NAD,$,2,"Namibia Dollar",
ne,Niger,XOF,\u20a3,0,"CFA Franc BCEAO",
nf,"Norfolk Island",AUD,$,2,"Australian Dollar",
ng,Nigeria,NGN,\u20a6,2,"Nigerian Naira",
ni,Nicaragua,NIO,\u00a4,2,"Nicaraguan Cordoba Oro",
nl,Netherlands,EUR,\u20ac,2,Euro,
no,Norway,NOK,\u00a4,2,"Norwegian Kroner",
np,Nepal,NPR,\u00a4,2,"Nepalese Rupee",
nr,Nauru,AUD,$,2,"Australian Dollar",
nu,Niue,NZD,$,2,"New Zealand Dollar",
nz,"New Zealand",NZD,$,2,"New Zealand Dollar",
om,Oman,OMR,\ufdfc,2,"Omani Rial",
pa,Panama,PAB,\u00a4,2,"Panamanian Balboa",
pe,Peru,PEN,\u00a4,2,"Peruvian Nuevo Sol",
pg,"Papua New Guinea",PGK,\u00a4,2,"Papua New Guinea Kina",
ph,Philippines,PHP,\u20b1,2,"Philippine Peso",
pk,Pakistan,PKR,\u00a4,2,"Pakistan Rupee",
pl,Poland,PLZ,\u00a4,2,"Polish Zloty",
pm,"St. Pierre and Miquelon",EUR,\u20ac,2,Euro,
pn,Pitcairn,NZD,$,2,"New Zealand Dollar",
pr,"Puerto Rico",USD,$,2,"US Dollar",
pt,Portugal,EUR,\u20ac,2,Euro,
pw,Palau,USD,$,2,"US Dollar",
py,Paraguay,PYG,\u00a4,0,"Paraguay Guarani",
qa,Qatar,QAR,\ufdfc,2,"Qatari Rial",
re,Reunion,EUR,\u20ac,2,Euro,
ro,Romania,ROL,\u00a4,2,"Romanian Leu",
ru,Russia,RUB,\u00a4,2,"Russian Rouble",
sa,"Saudi Arabia",SAR,\u00a4,2,"Saudi Riyal",
sb,"Solomon Islands",SBD,$,2,"Solomon Islands Dollar",
sc,Seychelles,SCR,\u00a4,2,"Seychelles Rupee",
sd,Sudan,SDD,\u00a4,2,"Sudanese Dinar",
se,Sweden,SEK,\u00a4,2,"Swedish Krona",
sg,Singapore,SGD,$,2,"Singapore Dollar",
sh,"St. Helena",SHP,\u00a4,2,"St. Helena Pound",
si,Slovenia,SIT,\u00a4,2,"Slovenian Tolar",
sj,"Svalbard and Jan Mayen Islands",NOK,\u00a4,2,"Norwegian Kroner",
sk,Slovakia,SKK,\u00a4,2,"Slovak Koruna",
sl,"Sierra Leone",SLL,\u00a4,2,"Sierra Leone Leone",
sm,"San Marino",EUR,\u20ac,2,Euro,
sn,Senegal,XOF,\u20a3,0,"CFA Franc BCEAO",
so,Somalia,SOS,\u00a4,2,"Somali Shilling",
sr,Suriname,SRG,\u00a4,2,"Suriname Guilder",
st,"Sao Tome and Principe",STD,\u00a4,2,"Sao Tome/Principe Dobra",
sv,"El Salvador",SVC,\u20a1,2,"El Salvador Colon",
sy,Syria,SYP,\u00a4,2,"Syrian Pound",
sz,Swaziland,SZL,\u00a4,2,"Swaziland Lilangeni",
tc,"Turks and Caicos Islands",USD,$,2,"US Dollar",
td,Chad,XAF,\u20a3,0,"CFA Franc BEAC",
tf,"French Southern Territories",EUR,\u20ac,2,Euro,
tg,Togo,XOF,\u20a3,0,"CFA Franc BCEAO",
th,Thailand,THB,\u0e3f,2,"Thai Baht",
tk,Tokelau,NZD,$,2,"New Zealand Dollar",
tn,Tunisia,TND,\u00a4,2,"Tunisian Dinar",
to,Tonga,TOP,\u00a4,2,"Tonga Pa'anga",
tr,Turkey,TRL,\u20a4,0,"Turkish Lira",
tt,"Trinidad and Tobago",TTD,$,2,"Trinidad/Tobago Dollar",
tv,Tuvalu,AUD,$,2,"Australian Dollar",
tw,Taiwan,TWD,$,2,"Taiwan Dollar",
tz,Tanzania,TZS,\u00a4,2,"Tanzanian Shilling",
ua,Ukraine,UAH,\u00a4,2,"Ukraine Hryvnia",
ug,Uganda,UGS,\u00a4,2,"Uganda Shilling",
um,"United States minor outlying islands",USD,$,2,"US Dollar",
uk,"United Kingdom",GBP,\u00a3,2,"British Pound",
us,"United States",USD,$,2,"US Dollar",
uy,Uruguay,UYP,\u20b1,2,"Uruguayan Peso",
va,Vatican,EUR,\u20ac,2,Euro,
vc,"Saint Vincent and the Grenadines",XCD,$,2,"East Caribbean Dollar",
ve,Venezuela,VEB,\u00a4,2,"Venezuelan Bolivar",
vg,"British Virgin Islands",USD,$,2,"US Dollar",
vi,"U.S. Virgin Islands",USD,$,2,"US Dollar",
vn,Vietnam,VND,\u20ab,2,"Vietnamese Dong",
vu,Vanuatu,VUV,\u00a4,0,"Vanuatu Vatu",
ye,Yemen,YER,\ufdfc,2,"Yemeni Rial",
yt,Mayotte,EUR,\u20ac,2,Euro,
yu,Yugoslavia,YUN,\u00a4,2,"Yugoslav Dinar",
za,"South Africa",ZAR,\u00a4,2,"South African Rand",
zm,Zambia,ZMK,\u00a4,2,"Zambian Kwacha",
zw,Zimbabwe,ZWD,$,2,"Zimbabwe Dollar",

Thomas Weidenfeller

unread,
Apr 25, 2002, 3:50:08 AM4/25/02
to
Roedy Green <ro...@mindprod.com> writes:
> I am somewhat disappointed by this class:

The whole issue is not as simple as it looks at first hand. But you
for sure know this.

My impression is, that the Sun programmers underestimated the
difficulties. Similar to how they underestimated the difficulties with
the Date class. Date issues have been fixed with Calendar, Currency
issues have not been fixed, and will maybe never. They should maybe not
try to fix this, but instead leaf this to domain specialists.

> 1. the getSymbol just repeats getCurrencyCode. It does not give you
> the unicode symbol except for Canada $

Sun maybe didn't recognize that they would have to know the name of
each and every currency in each and every supported locale to make this
work.

> 2. Locale.getAllISOCountries for which there is no corresponding
> Currency defined.

Sorry, I don't get what you mean.

> 3. There is no way to get the name of the currency in English e.g.
> "Israeli New Shekel"

Why would a user want to have a name in English? Why not in French,
Spanish, or German? It think Sun's problem again is that they would
have to provide all currency names in all locale languages of the
supported locales. Something which would result in a huge translation
and maintenance effort.

And there is the same problem as with getSymbol(): A currency might be
called different in the country, than outside the country, independent
of the language, but dependent on the circumstances. E.g. do you always
call the Canadian Dollar "Canadian Dollar", or just "Dollar"?

> 4. There is no provision for currency conversion.

Rates change, so rates can not be hard-code, or be part of an JDK/JRE.
Rates are also different, depending on the purpose. E.g. you get a
different conversion rate at the counter in the bank, than the banks
use among themselfs. You get different rates if you buy or if you sell
a foreign currency, where the definition of "foreign currency" depends
on the location of the bank.

There are also some specific conversion rules, which are not
straight-forward multiplications with a simple factor. E.g. to convert
any of the former currencies of the now Euro-Zone to any other former
currency in that zone, you have to go via an intermediate conversion.
The exact rules, including rounding rules, are dictated by law. BTW,
such conversions are still needed. Millions of still valid contracts
were of course written based on the old currencies.

/Thomas

Thomas Weidenfeller

unread,
Apr 25, 2002, 4:12:27 AM4/25/02
to
Roedy Green <ro...@mindprod.com> writes:
> One other related problem, Locale is missing the names for dozens of
> countries and the currencies for some too.

I think it was a bad idea from Sun to pre-define constants for some
locales. BTW, if I remember it correctly, this was one of the issues
Sun had with Microsoft's not-Java version. Microsoft extended the list
of predefined constants to include all locales supported by Windows.
Java code written using any of this additional constants was not
portable any more.

IMHO, Locale should just be a front-end to the i18n/l10n features of a
particular operating system, if any. If an installation of some
operating system does not support a specific locale, then well, and
application does not support it, too. If it is possible to install
additional locales on an operating system, then the Locale class should
be able to benefit from this.

I have a similar issue with resource bundles. IMHO, there should be a
wrapper which wraps an OS' native l10n mechanism, too. This would make
it possible to e.g. get local error messages from the operating system,
instead of having to provide translations in an own resource bundle.

> Here is a table of country codes, countries, currencies, currency
> decimal and currency names.

You have a slight problem here, too. Official country names, and
colloquial country names are not the same. In some circumstances,
however, it is important to use the name appropriate for the
situation.

/Thomas

Roedy Green

unread,
Apr 25, 2002, 12:38:37 PM4/25/02
to
On 25 Apr 2002 07:50:08 GMT, nob...@eed.ericsson.invalid (Thomas
Weidenfeller) wrote or quoted :

>> 2. Locale.getAllISOCountries for which there is no corresponding
>> Currency defined.
>
>Sorry, I don't get what you mean.

String[] countries = Locale.getISOCountries();
for ( int i=0; i<countries.length; i++ )
{
try
{
Locale locale = new Locale("en",countries[i]);
Currency currency = Currency.getInstance(locale);

will fail for some countries. It may be they don't have a currency,
like AQ Antarctica.

John O'Conner

unread,
Apr 25, 2002, 1:28:18 PM4/25/02
to

"Roedy Green" <ro...@mindprod.com> wrote in message
news:tmhccu8458hnq5v3h...@4ax.com...
> I am somewhat disappointed by this class:
>
>

Perhaps the information here will help:

John O'Conner

unread,
Apr 25, 2002, 1:39:54 PM4/25/02
to

"Thomas Weidenfeller" <nob...@eed.ericsson.invalid> wrote in message
news:aa8dpb$gla$2...@newstoo.ericsson.se...

> I think it was a bad idea from Sun to pre-define constants for some
> locales.

Yes, it was not such a great idea. Sun has not defined any more constants
since. It seemed a good idea at the time though.

>BTW, if I remember it correctly, this was one of the issues
> Sun had with Microsoft's not-Java version. Microsoft extended the list
> of predefined constants to include all locales supported by Windows.

Sun would have had no problem if MS had provided their OWN class in their
OWN package that improved upon the list of predefined constants. The problem
is that they did so in a base class library...java.util.Locale. This is a
no-no. Make all the improvements you want to Java libraries, but do so in
your own packages. Changing a base library class makes your code
non-portable.

> IMHO, Locale should just be a front-end to the i18n/l10n features of a
> particular operating system, if any.

This would definitely mean an app would behave differently from one system
to another. This is not in alignment with the "write once, run anywhere"
theme of the Java platform.

Regards,
John O'Conner

John O'Conner

unread,
Apr 25, 2002, 1:46:47 PM4/25/02
to

"Thomas Weidenfeller" <nob...@eed.ericsson.invalid> wrote in message
news:aa8cfg$gla$1...@newstoo.ericsson.se...

> Sun maybe didn't recognize that they would have to know the name of
> each and every currency in each and every supported locale to make this
> work.

Sun definitely is aware of this issue. The API design and implementation are
two separate issues. They can improve their implementation over time to
provide additional currency symbols for the various locales. You will notice
that each locale does at least know its own currency symbol. The problem is
that all locales don't necessarily know the localized symbols of all other
locales...a O(n-squared) localization problem that will improve over time.

Regards,
John O'Conner

Thomas Weidenfeller

unread,
Apr 26, 2002, 3:31:19 AM4/26/02
to
"John O'Conner" <jsoc...@earthlink.spamfree.net> writes:
> a O(n-squared) localization problem that will improve over time.

IMHO, they will never arrive. Such things change, and I don't think Sun
will release a new JDK/JRE just because some country slashed a few
zeros from its currency and add "new" in front of the old currency
name. Or another country joins the Euro, or some government gets
overthrown, and the currency replaced.

Also, you have additional problems. Some countries have more than one
valid currency (e.g. part of the Balkan officially used the
Deutschmark, and now uses the Euro in addition to the local currency).
What should the API return?

I don't think it is just a localization problem. Currencies become
valid at some point, and invalid at another point. The validity of a
currency even depends on the circumstances. These aspects are not
covered by the currency class.

IMHO, if one has to write a serious financial application, which has to
deal with currencies, you have to do it on your own, and maybe even
provide a mechanism for the end-user or end-user's system administrator
to configure a lot of things.

/Thomas

John O'Conner

unread,
Apr 26, 2002, 1:39:38 PM4/26/02
to

"Thomas Weidenfeller" <nob...@eed.ericsson.invalid> wrote in message
news:aaavo7$p47$1...@newstoo.ericsson.se...

> IMHO, they will never arrive. Such things change, and I don't think Sun
> will release a new JDK/JRE just because some country slashed a few
> zeros from its currency and add "new" in front of the old currency
> name. Or another country joins the Euro, or some government gets
> overthrown, and the currency replaced.

I think you've misunderstood my comment. The Currency class has a method
called getSymbol(). This method returns the localized symbol for the
currency. Right now, it appears that the en_US locale doesn't have a
localized en_US symbol for the Euro, which is silly but true. I said that
eventually this will be improved so that more locales have the localized
symbols for more currencies.

>
> I don't think it is just a localization problem.

Currency problems in applications are not just a localization
problem...agreed. But the fact that localized symbols in the J2SDK are
available for only some currencies is a localization problem that will
improve as Sun provides additional localized data in its platform.

Regards,
John O'Conner

Vivek S

unread,
Dec 8, 2022, 8:13:29 AM12/8/22
to
Can anyone help on when we will get the updated currency symbol change for Croatia country?
Since Croatia is moving from Kuna to Euro

e.d.pro...@gmail.com

unread,
Dec 8, 2022, 12:39:26 PM12/8/22
to
On Thursday, December 8, 2022 at 8:13:29 AM UTC-5, Vivek S wrote:
> Can anyone help on when we will get the updated currency symbol change for Croatia country?
> Since Croatia is moving from Kuna to Euro
I'm guessing it'll get updated when it changes, which is January 2023
0 new messages