glib2.sh 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466
  1. # GLib filename encoding guesser.
  2. # Author: Stanislav Brabec <sbrabec@suse.cz>
  3. # Additions are welcome.
  4. # This script must be executed after setting LANG variable.
  5. # Try filenames which are invalid in UTF-8 as locale specific.
  6. # For selected locales, G_FILENAME_ENCODING takes precedence.
  7. export G_BROKEN_FILENAMES=1
  8. # In West Europe there was used both ISO-8859-15 and ISO-8859-1.
  9. # There is no chance to recognize it, so we must guess.
  10. #west_europe_legacy_encoding=ISO-8859-1
  11. west_europe_legacy_encoding=ISO-8859-15
  12. # In Russia, "official" encoding is ISO-8859-5, but most GNOME users
  13. # preferred KOI8-R. We must guess.
  14. #russian_legacy_encoding=ISO-8859-5
  15. russian_legacy_encoding=KOI8-R
  16. # In former Yugoslavia sr_YU have covered two different alphabets -
  17. # one Latin and on Cyrillic. No chance to guess.
  18. sr_YU_legacy_encoding=ISO-8859-2,CP1250
  19. #sr_YU_legacy_encoding=ISO-8859-5
  20. # Japanese uses two legacy encodings. Guess sometimes fails, sometimes not.
  21. # Defining preferred encoding increases chance for success.
  22. japanese_legacy_encoding=EUC-JP
  23. #japanese_legacy_encoding=SHIFT_JIS
  24. case $LANG in
  25. aa_DJ* )
  26. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
  27. ;;
  28. af_ZA* )
  29. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
  30. ;;
  31. an_ES* )
  32. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-15,CP1252
  33. ;;
  34. ar_AE* )
  35. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-6
  36. ;;
  37. ar_BH* )
  38. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-6
  39. ;;
  40. ar_DZ* )
  41. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-6
  42. ;;
  43. ar_EG* )
  44. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-6
  45. ;;
  46. ar_IQ* )
  47. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-6
  48. ;;
  49. ar_JO* )
  50. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-6
  51. ;;
  52. ar_KW* )
  53. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-6
  54. ;;
  55. ar_LB* )
  56. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-6
  57. ;;
  58. ar_LY* )
  59. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-6
  60. ;;
  61. ar_MA* )
  62. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-6
  63. ;;
  64. ar_OM* )
  65. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-6
  66. ;;
  67. ar_QA* )
  68. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-6
  69. ;;
  70. ar_SA* )
  71. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-6
  72. ;;
  73. ar_SD* )
  74. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-6
  75. ;;
  76. ar_SY* )
  77. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-6
  78. ;;
  79. ar_TN* )
  80. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-6
  81. ;;
  82. ar_YE* )
  83. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-6
  84. ;;
  85. be_BY* )
  86. G_FILENAME_ENCODING=@locale,UTF-8,CP1251
  87. ;;
  88. bg_BG* )
  89. G_FILENAME_ENCODING=@locale,UTF-8,CP1251
  90. ;;
  91. br_FR* )
  92. G_FILENAME_ENCODING=@locale,UTF-8,$west_europe_legacy_encoding,CP1252
  93. ;;
  94. bs_BA* )
  95. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-2,CP1250
  96. ;;
  97. ca_ES* )
  98. G_FILENAME_ENCODING=@locale,UTF-8,$west_europe_legacy_encoding,CP1252
  99. ;;
  100. cs_CZ* )
  101. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-2,CP1250
  102. ;;
  103. cy_GB* )
  104. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-14,CP1252
  105. ;;
  106. da_DK* )
  107. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
  108. ;;
  109. de_AT* )
  110. G_FILENAME_ENCODING=@locale,UTF-8,$west_europe_legacy_encoding,CP1252
  111. ;;
  112. de_BE* )
  113. G_FILENAME_ENCODING=@locale,UTF-8,$west_europe_legacy_encoding,CP1252
  114. ;;
  115. de_DE* )
  116. G_FILENAME_ENCODING=@locale,UTF-8,$west_europe_legacy_encoding,CP1252
  117. ;;
  118. de_CH* )
  119. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
  120. ;;
  121. de_LU* )
  122. G_FILENAME_ENCODING=@locale,UTF-8,$west_europe_legacy_encoding,CP1252
  123. ;;
  124. el_GR* )
  125. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-7
  126. ;;
  127. en_AU* )
  128. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
  129. ;;
  130. en_BE* )
  131. G_FILENAME_ENCODING=@locale,UTF-8,$west_europe_legacy_encoding,CP1252
  132. ;;
  133. en_BW* )
  134. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
  135. ;;
  136. en_CA* )
  137. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
  138. ;;
  139. en_DK* )
  140. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
  141. ;;
  142. en_GB* )
  143. G_FILENAME_ENCODING=@locale,UTF-8,$west_europe_legacy_encoding,CP1252
  144. ;;
  145. en_HK* )
  146. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
  147. ;;
  148. en_IE* )
  149. G_FILENAME_ENCODING=@locale,UTF-8,$west_europe_legacy_encoding,CP1252
  150. ;;
  151. en_NZ* )
  152. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
  153. ;;
  154. en_PH* )
  155. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
  156. ;;
  157. en_SG* )
  158. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
  159. ;;
  160. en_US* )
  161. G_FILENAME_ENCODING=@locale,UTF-8,$west_europe_legacy_encoding,CP1252
  162. ;;
  163. en_ZA* )
  164. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
  165. ;;
  166. en_ZW* )
  167. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
  168. ;;
  169. es_AR* )
  170. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
  171. ;;
  172. es_BO* )
  173. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
  174. ;;
  175. es_CL* )
  176. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
  177. ;;
  178. es_CO* )
  179. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
  180. ;;
  181. es_CR* )
  182. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
  183. ;;
  184. es_DO* )
  185. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
  186. ;;
  187. es_EC* )
  188. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
  189. ;;
  190. es_ES* )
  191. G_FILENAME_ENCODING=@locale,UTF-8,$west_europe_legacy_encoding,CP1252
  192. ;;
  193. es_GT* )
  194. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
  195. ;;
  196. es_HN* )
  197. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
  198. ;;
  199. es_MX* )
  200. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
  201. ;;
  202. es_NI* )
  203. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
  204. ;;
  205. es_PA* )
  206. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
  207. ;;
  208. es_PE* )
  209. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
  210. ;;
  211. es_PR* )
  212. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
  213. ;;
  214. es_PY* )
  215. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
  216. ;;
  217. es_SV* )
  218. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
  219. ;;
  220. es_US* )
  221. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
  222. ;;
  223. es_UY* )
  224. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
  225. ;;
  226. es_VE* )
  227. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
  228. ;;
  229. et_EE* )
  230. G_FILENAME_ENCODING=@locale,UTF-8,$west_europe_legacy_encoding,CP1252
  231. ;;
  232. eu_ES* )
  233. G_FILENAME_ENCODING=@locale,UTF-8,$west_europe_legacy_encoding,CP1252
  234. ;;
  235. fa_IR* )
  236. G_FILENAME_ENCODING=@locale,UTF-8,CP1256
  237. ;;
  238. fi_FI* )
  239. G_FILENAME_ENCODING=@locale,UTF-8,$west_europe_legacy_encoding,CP1252
  240. ;;
  241. fo_FO* )
  242. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
  243. ;;
  244. fr_BE* )
  245. G_FILENAME_ENCODING=@locale,UTF-8,$west_europe_legacy_encoding,CP1252
  246. ;;
  247. fr_CA* )
  248. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
  249. ;;
  250. fr_FR* )
  251. G_FILENAME_ENCODING=@locale,UTF-8,$west_europe_legacy_encoding,CP1252
  252. ;;
  253. fr_CH* )
  254. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
  255. ;;
  256. fr_LU* )
  257. G_FILENAME_ENCODING=@locale,UTF-8,$west_europe_legacy_encoding,CP1252
  258. ;;
  259. ga_IE* )
  260. G_FILENAME_ENCODING=@locale,UTF-8,$west_europe_legacy_encoding,CP1252
  261. ;;
  262. gd_GB* )
  263. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-15,CP1252
  264. ;;
  265. gl_ES* )
  266. G_FILENAME_ENCODING=@locale,UTF-8,$west_europe_legacy_encoding,CP1252
  267. ;;
  268. gv_GB* )
  269. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
  270. ;;
  271. he_IL* )
  272. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-8
  273. ;;
  274. hr_HR* )
  275. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-2,CP1250
  276. ;;
  277. hu_HU* )
  278. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-2,CP1250
  279. ;;
  280. hy_AM* )
  281. G_FILENAME_ENCODING=@locale,UTF-8,ARMSCII-8
  282. ;;
  283. id_ID* )
  284. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
  285. ;;
  286. is_IS* )
  287. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
  288. ;;
  289. it_CH* )
  290. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
  291. ;;
  292. it_IT* )
  293. G_FILENAME_ENCODING=@locale,UTF-8,$west_europe_legacy_encoding,CP1252
  294. ;;
  295. iw_IL* )
  296. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-8
  297. ;;
  298. ja_JP* )
  299. G_FILENAME_ENCODING=@locale,UTF-8,$japanese_legacy_encoding,EUC-JP,SHIFT_JIS,ISO-8859-1
  300. ;;
  301. ka_GE* )
  302. G_FILENAME_ENCODING=@locale,UTF-8,GEORGIAN-PS
  303. ;;
  304. kl_GL* )
  305. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
  306. ;;
  307. km_KH* )
  308. G_FILENAME_ENCODING=@locale,UTF-8,GB18030
  309. ;;
  310. ko_KR* )
  311. G_FILENAME_ENCODING=@locale,UTF-8,EUC-KR,ISO-8859-1
  312. ;;
  313. kw_GB* )
  314. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
  315. ;;
  316. lg_UG* )
  317. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-10,CP1252
  318. ;;
  319. lt_LT* )
  320. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-13,CP1252
  321. ;;
  322. lv_LV* )
  323. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-13,CP1252
  324. ;;
  325. mi_NZ* )
  326. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-13,CP1252
  327. ;;
  328. mk_MK* )
  329. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-5,CP1251
  330. ;;
  331. ms_MY* )
  332. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
  333. ;;
  334. mt_MT* )
  335. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-3
  336. ;;
  337. nb_NO* )
  338. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
  339. ;;
  340. nl_BE* )
  341. G_FILENAME_ENCODING=@locale,UTF-8,$west_europe_legacy_encoding,CP1252
  342. ;;
  343. nl_NL* )
  344. G_FILENAME_ENCODING=@locale,UTF-8,$west_europe_legacy_encoding,CP1252
  345. ;;
  346. nn_NO* )
  347. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
  348. ;;
  349. no_NO* )
  350. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
  351. ;;
  352. oc_FR* )
  353. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
  354. ;;
  355. om_KE* )
  356. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
  357. ;;
  358. pl_PL* )
  359. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-2,CP1250
  360. ;;
  361. pt_BR* )
  362. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
  363. ;;
  364. pt_PT* )
  365. G_FILENAME_ENCODING=@locale,UTF-8,$west_europe_legacy_encoding,CP1252
  366. ;;
  367. ro_RO* )
  368. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-2,CP1250
  369. ;;
  370. ru_RU* )
  371. G_FILENAME_ENCODING=@locale,UTF-8,$russian_legacy_encoding,CP1251
  372. ;;
  373. ru_UA* )
  374. G_FILENAME_ENCODING=@locale,UTF-8,KOI8-U
  375. ;;
  376. sh_YU* )
  377. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-2,CP1250
  378. ;;
  379. sk_SK* )
  380. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-2,CP1250
  381. ;;
  382. sl_SI* )
  383. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-2,CP1250
  384. ;;
  385. so_DJ* )
  386. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
  387. ;;
  388. so_KE* )
  389. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
  390. ;;
  391. so_SO* )
  392. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
  393. ;;
  394. sq_AL* )
  395. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
  396. ;;
  397. sr_YU* )
  398. G_FILENAME_ENCODING=@locale,UTF-8,$sr_YU_legacy_encoding
  399. ;;
  400. st_ZA* )
  401. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
  402. ;;
  403. sv_FI* )
  404. G_FILENAME_ENCODING=@locale,UTF-8,$west_europe_legacy_encoding,CP1252
  405. ;;
  406. sv_SE* )
  407. G_FILENAME_ENCODING=@locale,UTF-8,$west_europe_legacy_encoding,CP1252
  408. ;;
  409. tg_TJ* )
  410. G_FILENAME_ENCODING=@locale,UTF-8,KOI8-T
  411. ;;
  412. th_TH* )
  413. G_FILENAME_ENCODING=@locale,UTF-8,TIS-620,ISO-8859-1
  414. ;;
  415. tl_PH* )
  416. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
  417. ;;
  418. tr_TR* )
  419. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-9
  420. ;;
  421. uk_UA* )
  422. G_FILENAME_ENCODING=@locale,UTF-8,KOI8-U
  423. ;;
  424. uz_UZ* )
  425. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
  426. ;;
  427. vi_VN* )
  428. G_FILENAME_ENCODING=@locale,UTF-8,TCVN5712-1,ISO-8859-1
  429. ;;
  430. wa_BE* )
  431. G_FILENAME_ENCODING=@locale,UTF-8,$west_europe_legacy_encoding,CP1252
  432. ;;
  433. xh_ZA* )
  434. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
  435. ;;
  436. yi_US* )
  437. G_FILENAME_ENCODING=@locale,UTF-8,CP1255
  438. ;;
  439. zh_CN* )
  440. G_FILENAME_ENCODING=@locale,UTF-8,GB2312,GB18030,GBK,ISO-8859-1
  441. ;;
  442. zh_HK* )
  443. G_FILENAME_ENCODING=@locale,UTF-8,BIG5-HKSCS,ISO-8859-1
  444. ;;
  445. zh_SG* )
  446. G_FILENAME_ENCODING=@locale,UTF-8,GB2312,GB18030,GBK,ISO-8859-1
  447. ;;
  448. zh_TW* )
  449. G_FILENAME_ENCODING=@locale,UTF-8,BIG5,EUC-TW,ISO-8859-1
  450. ;;
  451. zu_ZA* )
  452. G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-1,CP1252
  453. ;;
  454. esac
  455. export G_FILENAME_ENCODING
  456. unset west_europe_legacy_encoding
  457. unset russian_legacy_encoding
  458. unset sr_YU_legacy_encoding