diff --git a/lib/master.pike.in b/lib/master.pike.in index 6ddcc8c66474898889793f3216c7331af6d8354d..2e01664226f1c2540e7edb756e0e7c4244cd2918 100644 --- a/lib/master.pike.in +++ b/lib/master.pike.in @@ -4259,11 +4259,9 @@ protected object Charset; string decode_charset(string data, string charset) { if (!Charset) { - object mod = [object]resolv("Locale"); - - Charset = [object](mod && mod["Charset"]); + Charset = [object]resolv("Charset"); if (!Charset) - compile_cb_error("Cannot handle charset - no Locale.Charset module found."); + compile_cb_error("Cannot handle charset - no Charset module found."); } if (mixed err = catch { diff --git a/lib/modules/Calendar.pmod/Events.pmod b/lib/modules/Calendar.pmod/Events.pmod index e991ad285d9e634df60aeaf010612f69730c198d..749514d7f65024f127b506c2d7ed42621fbb16e7 100644 --- a/lib/modules/Calendar.pmod/Events.pmod +++ b/lib/modules/Calendar.pmod/Events.pmod @@ -236,7 +236,7 @@ Event.Namedays find_namedays(string region) break; case "charset": sscanf(s,"%s",charset); - object dec=Locale.Charset.decoder(charset); + object dec=Charset.decoder(charset); decoder=lambda(string s) { return dec->feed(s)->drain(); diff --git a/lib/modules/Charset.pmod/module.pmod b/lib/modules/Charset.pmod/module.pmod index 3cc87497bca60ce2846029999994c4d9b9e4496f..297beb7f0789c2e945fdd5a5ff4cc5a10c891431 100644 --- a/lib/modules/Charset.pmod/module.pmod +++ b/lib/modules/Charset.pmod/module.pmod @@ -107,7 +107,7 @@ protected private inherit _Charset; //! @example //! string win1252_to_string( string data ) //! { -//! return Locale.Charset.decoder("windows-1252")->feed( data )->drain(); +//! return Charset.decoder("windows-1252")->feed( data )->drain(); //! } class Decoder { @@ -133,7 +133,7 @@ class Decoder // FIXME: There ought to be a finish(string s) function. Now it's // possible that certain kinds of coding errors are simply ignored // if they occur last in a string. E.g. - // Locale.Charset.decoder("utf8")->feed("\345")->drain() returns "" + // Charset.decoder("utf8")->feed("\345")->drain() returns "" // instead of throwing an error about the incomplete UTF8 sequence, // and there's no good way to get this error. @@ -1192,15 +1192,15 @@ class DecodeError string charset; //! The decoding charset, typically as known to - //! @[Locale.Charset.decoder]. + //! @[Charset.decoder]. //! //! @note //! Other code may produce errors of this type. In that case this - //! name is something that @[Locale.Charset.decoder] does not accept + //! name is something that @[Charset.decoder] does not accept //! (unless it implements exactly the same charset), and it should - //! be reasonably certain that @[Locale.Charset.decoder] never - //! accepts that name in the future (unless it is extended to - //! implement exactly the same charset). + //! be reasonably certain that @[Charset.decoder] never accepts that + //! name in the future (unless it is extended to implement exactly + //! the same charset). protected void create (string err_str, int err_pos, string charset, void|string reason, void|array bt) @@ -1245,15 +1245,15 @@ class EncodeError string charset; //! The encoding charset, typically as known to - //! @[Locale.Charset.encoder]. + //! @[Charset.encoder]. //! //! @note //! Other code may produce errors of this type. In that case this - //! name is something that @[Locale.Charset.encoder] does not accept + //! name is something that @[Charset.encoder] does not accept //! (unless it implements exactly the same charset), and it should - //! be reasonably certain that @[Locale.Charset.encoder] never - //! accepts that name in the future (unless it is extended to - //! implement exactly the same charset). + //! be reasonably certain that @[Charset.encoder] never accepts that + //! name in the future (unless it is extended to implement exactly + //! the same charset). protected void create (string err_str, int err_pos, string charset, void|string reason, void|array bt) diff --git a/lib/modules/Graphics.pmod/Graph.pmod/graph.h b/lib/modules/Graphics.pmod/Graph.pmod/graph.h index 7c2bdac5fdee09e556f20244173307eba2c74fb0..726563d79ba326c8708c46eeb2274417597096a9 100644 --- a/lib/modules/Graphics.pmod/Graph.pmod/graph.h +++ b/lib/modules/Graphics.pmod/Graph.pmod/graph.h @@ -2,8 +2,7 @@ #define PI 3.14159265358979 #define VOIDSYMBOL "\n" #define SEP "\t" -#define UNICODE(TEXT,ENCODING) Locale.Charset.decoder(ENCODING)->feed(TEXT)->drain() - +#define UNICODE(TEXT,ENCODING) Charset.decoder(ENCODING)->feed(TEXT)->drain() #define GETFONT(WHATFONT) ((diagram_data->WHATFONT) || diagram_data->font) //#define BG_DEBUG 1 diff --git a/lib/modules/Locale.pmod/module.pmod b/lib/modules/Locale.pmod/module.pmod index 66d4ca9a6bb7826756c487905257ef2ca26abd00..fd26dead3890edc87e7c48fe6b1bbde3623f8b18 100644 --- a/lib/modules/Locale.pmod/module.pmod +++ b/lib/modules/Locale.pmod/module.pmod @@ -206,10 +206,6 @@ class LocaleObject } } -// Used to delay lookup of the Charset module until run-time when dumped, -// and thus resolve the circularity. -protected object(Locale) locale = Locale; - object get_object(string project, string lang) { // Is there such a project? @@ -282,8 +278,7 @@ object get_object(string project, string lang) { default: object dec; - // FIXME: Is this the best way of using Locale.Charset.decoder ? - if(catch(dec = locale.Charset.decoder(encoding))) { + if(catch(dec = Charset.decoder(encoding))) { werror("\n* Warning: unknown encoding %O in %O\n", encoding, filename); break; diff --git a/lib/modules/MIME.pmod/module.pmod b/lib/modules/MIME.pmod/module.pmod index f4757b9624ff25683e3d6d6d42df39b33c07eb9d..22d343b7f31a888837b9cbb3b79d2ad1e829ecd1 100644 --- a/lib/modules/MIME.pmod/module.pmod +++ b/lib/modules/MIME.pmod/module.pmod @@ -349,7 +349,7 @@ string encode_word( string|array(string) word, string encoding ) protected string remap(array(string) item) { if (sizeof(item)>1 && item[1]) - return Locale.Charset.decoder(item[1])->feed(item[0])->drain(); + return Charset.decoder(item[1])->feed(item[0])->drain(); else return item[0]; } @@ -361,7 +361,7 @@ protected array(string) reremap(string word, string|function(string:string) sele return ({ word,0 }); string s = stringp(selector)? selector : selector(word); return s? - ({ Locale.Charset.encoder(s,replacement,repcb)->feed(word)->drain(), s }) : + ({ Charset.encoder(s,replacement,repcb)->feed(word)->drain(), s }) : ({ word,0 }); } @@ -563,9 +563,9 @@ string encode_words_text(array(string|array(string)) phrase, string encoding) //! Either the name of a character set to use, or a function returning //! a character set to use given a text fragment as input. //! @param replacement -//! The @[replacement] argument to use when calling @[Locale.Charset.encoder] +//! The @[replacement] argument to use when calling @[Charset.encoder] //! @param repcb -//! The @[repcb] argument to use when calling @[Locale.Charset.encoder] +//! The @[repcb] argument to use when calling @[Charset.encoder] //! //! @seealso //! @[MIME.encode_words_tokenized_remapped] diff --git a/lib/modules/Parser.pmod/XML.pmod/Tree.pmod b/lib/modules/Parser.pmod/XML.pmod/Tree.pmod index 0b0e28944ed10193bd8d58df2a094745ffeab55e..5807b1a8cd22d46122f5b98dee6aa53379e6ed22 100644 --- a/lib/modules/Parser.pmod/XML.pmod/Tree.pmod +++ b/lib/modules/Parser.pmod/XML.pmod/Tree.pmod @@ -1313,7 +1313,7 @@ protected class VirtualNode { else low_render_xml(data, this, text_quote, attribute_quote, namespace_lookup); - return Locale.Charset.encoder(encoding)->feed((string)data)->drain(); + return Charset.encoder(encoding)->feed((string)data)->drain(); } //! Creates an XML representation for the node sub tree and streams @@ -1326,7 +1326,7 @@ protected class VirtualNode { encoder->feed(args[*]); f->write(encoder->drain()); } - } (f, Locale.Charset.encoder(get_encoding())); + } (f, Charset.encoder(get_encoding())); set_short_namespaces(); if(preserve_roxen_entities) low_render_xml(data, this, roxen_text_quote, diff --git a/lib/modules/Protocols.pmod/HTTP.pmod/Query.pike b/lib/modules/Protocols.pmod/HTTP.pmod/Query.pike index 4373eb23d7cd0fd8289d67ebd82b0976d53d1956..10396cb4d66005921c532c77888d60900707d522 100644 --- a/lib/modules/Protocols.pmod/HTTP.pmod/Query.pike +++ b/lib/modules/Protocols.pmod/HTTP.pmod/Query.pike @@ -1056,7 +1056,7 @@ string data(int|void max_length) return buf[datapos..datapos+len-1]; } -protected Locale.Charset.Decoder charset_decoder; +protected Charset.Decoder charset_decoder; //! Gives back data, but decoded according to the content-type //! character set. @@ -1068,9 +1068,9 @@ string unicode_data() { if(headers["content-type"]) sscanf(headers["content-type"], "%*scharset=%s", charset); if(!charset) - charset_decoder = Locale.Charset.decoder("ascii"); + charset_decoder = Charset.decoder("ascii"); else - charset_decoder = Locale.Charset.decoder(charset); + charset_decoder = Charset.decoder(charset); } return charset_decoder->feed(data())->drain(); } diff --git a/lib/modules/Protocols.pmod/LDAP.pmod/client.pike b/lib/modules/Protocols.pmod/LDAP.pmod/client.pike index f11117d8ae8217e72103e13d9c085e2bdbf053c3..2f2dd7051713e7f3bc51e0cf767d1eca8a7977fb 100644 --- a/lib/modules/Protocols.pmod/LDAP.pmod/client.pike +++ b/lib/modules/Protocols.pmod/LDAP.pmod/client.pike @@ -157,8 +157,8 @@ protected function(string:string) get_attr_encoder (string attr) return 0; } -typedef string|Locale.Charset.DecodeError| - array(string|Locale.Charset.DecodeError) ResultAttributeValue; +typedef string|Charset.DecodeError| + array(string|Charset.DecodeError) ResultAttributeValue; typedef mapping(string:ResultAttributeValue) ResultEntry; @@ -268,9 +268,9 @@ typedef mapping(string:ResultAttributeValue) ResultEntry; string errmsg = describe_error (err) + \ "The string is the DN of an entry.\n"; \ if (flags & SEARCH_RETURN_DECODE_ERRORS) \ - DN = Locale.Charset.DecodeError (DN, -1, 0, errmsg); \ + DN = Charset.DecodeError (DN, -1, 0, errmsg); \ else \ - throw (Locale.Charset.DecodeError (DN, -1, 0, errmsg)); \ + throw (Charset.DecodeError (DN, -1, 0, errmsg)); \ } \ } while (0) @@ -296,9 +296,9 @@ typedef mapping(string:ResultAttributeValue) ResultEntry; describe_error (err), ATTR, stringp (dn) ? dn : dn[0], \ decoder, descr1, descr2); \ if (flags & SEARCH_RETURN_DECODE_ERRORS) \ - VALUE = Locale.Charset.DecodeError (VALUE, -1, 0, errmsg); \ + VALUE = Charset.DecodeError (VALUE, -1, 0, errmsg); \ else \ - throw (Locale.Charset.DecodeError (VALUE, -1, 0, errmsg)); \ + throw (Charset.DecodeError (VALUE, -1, 0, errmsg)); \ } \ } while (0) @@ -312,9 +312,9 @@ typedef mapping(string:ResultAttributeValue) ResultEntry; "in entry with DN %O.\n", \ describe_error (err), ATTR, stringp (dn) ? dn : dn[0]); \ if (flags & SEARCH_RETURN_DECODE_ERRORS) \ - VALUE = Locale.Charset.DecodeError (VALUE, -1, 0, errmsg); \ + VALUE = Charset.DecodeError (VALUE, -1, 0, errmsg); \ else \ - throw (Locale.Charset.DecodeError (VALUE, -1, 0, errmsg)); \ + throw (Charset.DecodeError (VALUE, -1, 0, errmsg)); \ } \ } while (0) @@ -329,7 +329,7 @@ typedef mapping(string:ResultAttributeValue) ResultEntry; ent[attr] = vals; } else - foreach (vals; int i; string|Locale.Charset.DecodeError val) { + foreach (vals; int i; string|Charset.DecodeError val) { DECODE_VALUE (attr, val, decoder); vals[i] = val; } @@ -462,7 +462,7 @@ typedef mapping(string:ResultAttributeValue) ResultEntry; //! valued. //! //! If @[Protocols.LDAP.SEARCH_RETURN_DECODE_ERRORS] was given - //! to @[search] then @[Locale.Charset.DecodeError] objects are + //! to @[search] then @[Charset.DecodeError] objects are //! returned in place of a string whenever an attribute value //! fails to be decoded. //! @@ -470,7 +470,7 @@ typedef mapping(string:ResultAttributeValue) ResultEntry; //! This special entry contains the object name of the entry as //! a distinguished name. //! - //! This might also be a @[Locale.Charset.DecodeError] if + //! This might also be a @[Charset.DecodeError] if //! @[Protocols.LDAP.SEARCH_RETURN_DECODE_ERRORS] was given to //! @[search]. //! @endmapping @@ -480,8 +480,8 @@ typedef mapping(string:ResultAttributeValue) ResultEntry; //! //! @throws //! Unless @[Protocols.LDAP.SEARCH_RETURN_DECODE_ERRORS] was - //! given to @[search], a @[Locale.Charset.DecodeError] is thrown - //! if there is an error decoding the DN or any attribute value. + //! given to @[search], a @[Charset.DecodeError] is thrown if + //! there is an error decoding the DN or any attribute value. //! //! @note //! It's undefined whether or not destructive operations on the @@ -526,7 +526,7 @@ typedef mapping(string:ResultAttributeValue) ResultEntry; //! @note //! In Pike 7.6 and earlier, this field was incorrectly returned //! in UTF-8 encoded form for LDAPv3 connections. - string|Locale.Charset.DecodeError get_dn() + string|Charset.DecodeError get_dn() { string|array(string) dn = fetch()->dn; return stringp (dn) ? dn : dn[0]; // To cope with SEARCH_MULTIVAL_ARRAYS_ONLY. @@ -563,8 +563,8 @@ typedef mapping(string:ResultAttributeValue) ResultEntry; //! //! @throws //! Unless @[Protocols.LDAP.SEARCH_RETURN_DECODE_ERRORS] was - //! given to @[search], a @[Locale.Charset.DecodeError] is thrown - //! if there is an error decoding the DN or any attribute value. + //! given to @[search], a @[Charset.DecodeError] is thrown if + //! there is an error decoding the DN or any attribute value. //! //! @seealso //! @[fetch] diff --git a/lib/modules/Protocols.pmod/LDAP.pmod/module.pmod b/lib/modules/Protocols.pmod/LDAP.pmod/module.pmod index 5e42e931a4d4c00f4587282c81ab280c01cd4667..419e603972daee1da1dff61ba17be86130dab114 100644 --- a/lib/modules/Protocols.pmod/LDAP.pmod/module.pmod +++ b/lib/modules/Protocols.pmod/LDAP.pmod/module.pmod @@ -190,8 +190,7 @@ constant SEARCH_RETURN_DECODE_ERRORS = 4; //! Don't throw attribute value decode errors, instead return them //! in the result from @[Protocols.LDAP.client.result.fetch] in //! place of the value. I.e. anywhere an attribute value string -//! occurs, you might instead have a @[Locale.Charset.DecodeError] -//! object. +//! occurs, you might instead have a @[Charset.DecodeError] object. //! @enddl constant SCOPE_BASE = 0; diff --git a/lib/modules/Protocols.pmod/OBEX.pmod b/lib/modules/Protocols.pmod/OBEX.pmod index c2ff5e33620b6738af6502461e1364bfe0b0f822..267c5fcada12cbd1f5c9ef6ad0b36e5f6759f27b 100644 --- a/lib/modules/Protocols.pmod/OBEX.pmod +++ b/lib/modules/Protocols.pmod/OBEX.pmod @@ -68,7 +68,7 @@ typedef mapping(HeaderIdentifier:string|int|array) Headers; string encode_headers(Headers h) { string r0 = "", r = ""; - object e = Locale.Charset.encoder("utf16-be"); + object e = Charset.encoder("utf16-be"); foreach(h; HeaderIdentifier hi; string|int|array va) foreach(arrayp(va)? va:({va}), string|int v) { string vv; @@ -98,7 +98,7 @@ string encode_headers(Headers h) Headers decode_headers(string h) { Headers r = ([]); - object d = Locale.Charset.decoder("utf16-be"); + object d = Charset.decoder("utf16-be"); while(sizeof(h)) { HeaderIdentifier hi = h[0]; string|int v = 0; diff --git a/lib/modules/Search.pmod/Filter.pmod/Charset.pmod b/lib/modules/Search.pmod/Filter.pmod/Charset.pmod index 00818eccc779ba6d38c99911ececc66787ca240f..cf96b726a7f3dd3532fb956d11a2c7d62bcbe2a1 100644 --- a/lib/modules/Search.pmod/Filter.pmod/Charset.pmod +++ b/lib/modules/Search.pmod/Filter.pmod/Charset.pmod @@ -21,18 +21,16 @@ string low_decode_charset( string data, string charset ) case "eucjp": case "eucjapan": case "japanese": - return Locale.Charset.decoder( "euc-jp" )->feed( data )->drain(); + return Charset.decoder( "euc-jp" )->feed( data )->drain(); case "xsjis": case "shiftjis": case "jis": - return Locale.Charset.decoder("Shift_JIS")->feed(data)->drain(); + return Charset.decoder("Shift_JIS")->feed(data)->drain(); default: catch { - return Locale.Charset.decoder( charset ) - ->feed( data ) - ->drain(); + return Charset.decoder( charset )->feed( data )->drain(); }; werror("\n****** Warning: Unknown charset: '"+charset+"'\n"); return data; @@ -96,7 +94,7 @@ string decode_http( string data, mapping headers, // 3.2: iso-2022, probably if( sizeof(data[..100]/"\33$") > 1 ) - return Locale.Charset.decoder( "iso-2022-jp")->feed( data )->drain(); + return Charset.decoder( "iso-2022-jp")->feed( data )->drain(); return default_charset ? decode_charset( data, default_charset ) : data; } diff --git a/lib/modules/Sql.pmod/mysql.pike b/lib/modules/Sql.pmod/mysql.pike index f8073dacbc9b371e6c7d293b21e65635cda937a9..c2f991298c98363f95a0ad1beb2ff6518b6e7a47 100644 --- a/lib/modules/Sql.pmod/mysql.pike +++ b/lib/modules/Sql.pmod/mysql.pike @@ -309,9 +309,9 @@ void set_charset (string charset) //! control chars in ISO-8859-1). For instance, the euro currency //! sign is @expr{0x80@}. //! -//! You can use the @expr{mysql-latin1@} encoding in the -//! @[Locale.Charset] module to do conversions, or just use the -//! special @expr{"unicode"@} charset instead. +//! You can use the @expr{mysql-latin1@} encoding in the @[Charset] +//! module to do conversions, or just use the special +//! @expr{"unicode"@} charset instead. //! //! @seealso //! @[get_charset], @[set_unicode_encode_mode], @[set_unicode_decode_mode] diff --git a/lib/modules/Sql.pmod/tds.pike b/lib/modules/Sql.pmod/tds.pike index 929a930e24d309434681b8be15a2019dab9b75d5..47ff268ca40b3b68a9863245eef86adb99434d5d 100644 --- a/lib/modules/Sql.pmod/tds.pike +++ b/lib/modules/Sql.pmod/tds.pike @@ -184,12 +184,12 @@ protected { predef::error(last_error = msg); } - protected object utf16enc = Locale.Charset.encoder("UTF16LE"); + protected object utf16enc = Charset.encoder("UTF16LE"); protected string string_to_utf16(string s) { return utf16enc->feed(s)->drain(); } - protected object utf16dec = Locale.Charset.decoder("UTF16LE"); + protected object utf16dec = Charset.decoder("UTF16LE"); protected string utf16_to_string(string s) { return utf16dec->feed(s)->drain(); diff --git a/lib/modules/Standards.pmod/ASN1.pmod/Types.pmod b/lib/modules/Standards.pmod/ASN1.pmod/Types.pmod index 8b377a17a145afa440516e6e16c3abc46139d421..c29322c4a99b995a04acf4c2f5aff8db522e40d9 100644 --- a/lib/modules/Standards.pmod/ASN1.pmod/Types.pmod +++ b/lib/modules/Standards.pmod/ASN1.pmod/Types.pmod @@ -711,7 +711,7 @@ int(0..1) asn1_teletex_valid (string s) //! (control characters). //! //! @seealso -//! @[Locale.Charset] +//! @[Charset] class TeletexString { inherit String; diff --git a/lib/modules/Stdio.pmod/module.pmod b/lib/modules/Stdio.pmod/module.pmod index 005f476a95993605d16dec3967f087cd4410a543..03bdf3428f53341c0f090bda74eaa565e95dea1a 100644 --- a/lib/modules/Stdio.pmod/module.pmod +++ b/lib/modules/Stdio.pmod/module.pmod @@ -1807,8 +1807,8 @@ class FILE if( charset != "iso-8859-1" && charset != "ascii") { - object in = master()->resolv("Locale.Charset.decoder")( charset ); - object out = master()->resolv("Locale.Charset.encoder")( charset ); + object in = master()->resolv("Charset.decoder")( charset ); + object out = master()->resolv("Charset.encoder")( charset ); input_conversion = [function(string:string)]lambda( string s ) { diff --git a/lib/modules/Tools.pmod/Standalone.pmod/extract_locale.pike b/lib/modules/Tools.pmod/Standalone.pmod/extract_locale.pike index c341e2328a0a26280f65ef3314ecc5b32c2efecd..adc52cf25201f56dd2c6dcac897413322691bdee 100755 --- a/lib/modules/Tools.pmod/Standalone.pmod/extract_locale.pike +++ b/lib/modules/Tools.pmod/Standalone.pmod/extract_locale.pike @@ -116,7 +116,7 @@ function get_encoder(string encoding) { default: object enc; - if(catch( enc = Locale.Charset.encoder( encoding ) )) { + if(catch( enc = Charset.encoder( encoding ) )) { werror("\n* Error: Unknown encoding %O!\n", encoding); exit(1); } @@ -150,7 +150,7 @@ function get_decoder(string encoding) { default: object dec; - if(catch( dec = Locale.Charset.decoder( encoding ) )) { + if(catch( dec = Charset.decoder( encoding ) )) { werror("\n* Error: Unknown encoding %O!\n", encoding); exit(1); } diff --git a/lib/modules/Tools.pmod/Standalone.pmod/test_pike.pike b/lib/modules/Tools.pmod/Standalone.pmod/test_pike.pike index cd4d36b79374769273607253cff6258640598eb5..078c47ca13a073d904314a81e1dac481767f6077 100755 --- a/lib/modules/Tools.pmod/Standalone.pmod/test_pike.pike +++ b/lib/modules/Tools.pmod/Standalone.pmod/test_pike.pike @@ -38,10 +38,10 @@ mapping(string:int) cond_cache=([]); void print_code(string test) { - array lines = Locale.Charset.encoder("iso-8859-1", 0, - lambda(string s) { - return sprintf("\\%o", s[0]); - })->feed(test)->drain()/"\n"; + array lines = Charset.encoder("iso-8859-1", 0, + lambda(string s) { + return sprintf("\\%o", s[0]); + })->feed(test)->drain()/"\n"; foreach(lines; int r; string line) { log_msg("%3d: %s\n", r+1, line); } diff --git a/lib/modules/_Image.pmod/Fonts.pmod b/lib/modules/_Image.pmod/Fonts.pmod index c271cfe8facd28915f2dac4e1e81785e3192890d..41b79509b64c4d59434e1d709680ff98aeb05d64 100644 --- a/lib/modules/_Image.pmod/Fonts.pmod +++ b/lib/modules/_Image.pmod/Fonts.pmod @@ -270,7 +270,7 @@ class Font( protected string file, ->add_container( "encoding", lambda(Parser.HTML p, mapping m, string enc) { - codec=Locale.Charset.encoder(enc,""); + codec=Charset.encoder(enc,""); } ) ->feed( Stdio.read_file( file+".properties" ) ) ->read(); diff --git a/src/builtin_functions.c b/src/builtin_functions.c index fd514a5841336552f04de2ccb83fd248e354f159..be8363228895932def2f5e6f1bfa83b7087b01db 100644 --- a/src/builtin_functions.c +++ b/src/builtin_functions.c @@ -645,14 +645,14 @@ static struct case_info *find_ci_shift0(INT32 c) *! *! @note *! Assumes the string or character to be coded according to - *! ISO-10646 (aka Unicode). If they are not, @[Locale.Charset.decoder] - *! can do the initial conversion for you. + *! ISO-10646 (aka Unicode). If they are not, @[Charset.decoder] can + *! do the initial conversion for you. *! *! @note *! Prior to Pike 7.5 this function only accepted strings. *! *! @seealso - *! @[upper_case()], @[Locale.Charset.decoder] + *! @[upper_case()], @[Charset.decoder] */ PMOD_EXPORT void f_lower_case(INT32 args) { @@ -722,14 +722,14 @@ PMOD_EXPORT void f_lower_case(INT32 args) *! *! @note *! Assumes the string or character to be coded according to - *! ISO-10646 (aka Unicode). If they are not, @[Locale.Charset.decoder] - *! can do the initial conversion for you. + *! ISO-10646 (aka Unicode). If they are not, @[Charset.decoder] can + *! do the initial conversion for you. *! *! @note *! Prior to Pike 7.5 this function only accepted strings. *! *! @seealso - *! @[lower_case()], @[Locale.Charset.decoder] + *! @[lower_case()], @[Charset.decoder] */ PMOD_EXPORT void f_upper_case(INT32 args) { @@ -1658,7 +1658,7 @@ static int generate_zero_type(node *n) *! Characters in range 0x010000 - 0x10ffff are encoded using surrogates. *! *! @seealso - *! @[Locale.Charset.decoder()], @[string_to_utf8()], @[unicode_to_string()], + *! @[Charset.decoder()], @[string_to_utf8()], @[unicode_to_string()], *! @[utf8_to_string()] */ PMOD_EXPORT void f_string_to_unicode(INT32 args) @@ -1794,7 +1794,7 @@ PMOD_EXPORT void f_string_to_unicode(INT32 args) *! This function did not decode surrogates in Pike 7.2 and earlier. *! *! @seealso - *! @[Locale.Charset.decoder()], @[string_to_unicode()], @[string_to_utf8()], + *! @[Charset.decoder()], @[string_to_unicode()], @[string_to_utf8()], *! @[utf8_to_string()] */ PMOD_EXPORT void f_unicode_to_string(INT32 args) @@ -1960,7 +1960,7 @@ PMOD_EXPORT void f_unicode_to_string(INT32 args) *! characters are however not UTF-8 compliant. *! *! @seealso - *! @[Locale.Charset.encoder()], @[string_to_unicode()], + *! @[Charset.encoder()], @[string_to_unicode()], *! @[unicode_to_string()], @[utf8_to_string()] */ PMOD_EXPORT void f_string_to_utf8(INT32 args) @@ -2115,7 +2115,7 @@ PMOD_EXPORT void f_string_to_utf8(INT32 args) *! non-shortest forms are not decoded. An error is thrown instead. *! *! @seealso - *! @[Locale.Charset.encoder()], @[string_to_unicode()], @[string_to_utf8()], + *! @[Charset.encoder()], @[string_to_unicode()], @[string_to_utf8()], *! @[unicode_to_string()] */ PMOD_EXPORT void f_utf8_to_string(INT32 args) diff --git a/src/cpp.c b/src/cpp.c index fb7e976342a060fcf68c23745246cfc4e239fdfa..8f4b66e8ce38e1943e5a590f314bc143adfbaffc 100644 --- a/src/cpp.c +++ b/src/cpp.c @@ -311,7 +311,7 @@ static void cpp_warning(struct cpp *this, const char *cpp_warn_fmt, ...) *! @[raw] decoded to UNICODE, or @expr{0@} (zero) if the decoding failed. *! *! @seealso - *! @[Locale.Charset] + *! @[Charset] */ /*! @endclass @@ -525,9 +525,9 @@ void cpp_change_compat(struct cpp *this, int major, int minor) /*! @directive #charset *! - *! Inform the preprocessor about which charset the file is encoded with. - *! The Locale.Charset module is called with this string to decode the - *! remainder of the file. + *! Inform the preprocessor about which charset the file is encoded + *! with. The Charset module is called with this string to decode + *! the remainder of the file. */ /*! @directive #if diff --git a/src/modules/Parser/xml.cmod b/src/modules/Parser/xml.cmod index 869d9af85aa800d9811208cc13f9b7a707d9fcf5..14892cadf53ea9ad877e9834236c33de5c59c48f 100644 --- a/src/modules/Parser/xml.cmod +++ b/src/modules/Parser/xml.cmod @@ -3455,7 +3455,7 @@ PIKEFUN string autoconvert(string s) } /* <?xml version = "1.0" encoding = "encname." */ - push_constant_text("Locale.Charset.decoder"); + push_constant_text("Charset.decoder"); APPLY_MASTER("resolv",1); push_string(make_shared_binary_string0(STR0(s)+encstart, pos-encstart)); diff --git a/src/modules/_Charset/charsetmod.c b/src/modules/_Charset/charsetmod.c index 1dc2d4a1c6ee9c75d8fc73b71d6972c6b0249ab0..333416052f698da8010f3d76687b13e892673211 100644 --- a/src/modules/_Charset/charsetmod.c +++ b/src/modules/_Charset/charsetmod.c @@ -166,10 +166,10 @@ static void DECLSPEC(noreturn) transcode_error_va ( if (encode) { if (TYPEOF(encode_err_prog) == T_INT) { - push_text ("Locale.Charset.EncodeError"); + push_text ("Charset.EncodeError"); SAFE_APPLY_MASTER ("resolv", 1); if (TYPEOF(sp[-1]) != T_PROGRAM && TYPEOF(sp[-1]) != T_FUNCTION) - Pike_error ("Failed to resolve Locale.Charset.EncodeError " + Pike_error ("Failed to resolve Charset.EncodeError " "to a program - unable to throw an encode error.\n"); move_svalue (&encode_err_prog, --sp); } @@ -178,10 +178,10 @@ static void DECLSPEC(noreturn) transcode_error_va ( else { if (TYPEOF(decode_err_prog) == T_INT) { - push_text ("Locale.Charset.DecodeError"); + push_text ("Charset.DecodeError"); SAFE_APPLY_MASTER ("resolv", 1); if (TYPEOF(sp[-1]) != T_PROGRAM && TYPEOF(sp[-1]) != T_FUNCTION) - Pike_error ("Failed to resolve Locale.Charset.DecodeError " + Pike_error ("Failed to resolve Charset.DecodeError " "to a program - unable to throw an decode error.\n"); move_svalue (&decode_err_prog, --sp); } diff --git a/src/modules/_Charset/iso2022.c b/src/modules/_Charset/iso2022.c index 1a19e18b80b1d00f4dce6d0caf9a3fa82945d9a6..bb2bbe53e4089dfd48e62af2120d23ca4ac4b78a 100644 --- a/src/modules/_Charset/iso2022.c +++ b/src/modules/_Charset/iso2022.c @@ -22,7 +22,7 @@ #define sp Pike_sp #define fp Pike_fp -#define PRGM_NAME "Locale.Charset.ISO2022" +#define PRGM_NAME "Charset.ISO2022" static struct program *iso2022dec_program = NULL; diff --git a/src/modules/_Charset/testsuite.in b/src/modules/_Charset/testsuite.in index c55bd963e3fda07cd210703bd08407a492147209..02c0c93bbdd23bf138bfb907c3c59e33f0775b72 100644 --- a/src/modules/_Charset/testsuite.in +++ b/src/modules/_Charset/testsuite.in @@ -1,112 +1,112 @@ START_MARKER -// Locale.Charset.decoder -test_true([[objectp(Locale.Charset)]]) -test_true([[functionp(Locale.Charset.decoder)]]) -test_true([[objectp(Locale.Charset.decoder("latin1"))]]) -test_true([[functionp(Locale.Charset.decoder("latin1")->feed)]]) -test_eq([[Locale.Charset.decoder("latin1")->feed("xyz����߶")->drain()]],"xyz����߶") +// Charset.decoder +test_true([[objectp(Charset)]]) +test_true([[functionp(Charset.decoder)]]) +test_true([[objectp(Charset.decoder("latin1"))]]) +test_true([[functionp(Charset.decoder("latin1")->feed)]]) +test_eq([[Charset.decoder("latin1")->feed("xyz����߶")->drain()]],"xyz����߶") // 7-bit ASCII -test_eq([[Locale.Charset.encoder("ASCII", "?", lambda(string ch) { return "&#" + ch[0] + ";"; })->feed("r�ksm�rg�s")->drain()]],"räksmörgås") +test_eq([[Charset.encoder("ASCII", "?", lambda(string ch) { return "&#" + ch[0] + ";"; })->feed("r�ksm�rg�s")->drain()]],"räksmörgås") -// Locale.Charset.rfc1345 -test_eq([[Locale.Charset.decoder("iso646-se")->feed("}{|][\\")->drain()]],"������") -test_eq([[Locale.Charset.decoder("iso-ir-126")->feed("abc���")->drain()]], +// Charset.rfc1345 +test_eq([[Charset.decoder("iso646-se")->feed("}{|][\\")->drain()]],"������") +test_eq([[Charset.decoder("iso-ir-126")->feed("abc���")->drain()]], "abc\x3b5\x3b4\x3c6") -// Locale.Charset.ISO2022 -test_eq([[Locale.Charset.decoder("iso-2022")-> +// Charset.ISO2022 +test_eq([[Charset.decoder("iso-2022")-> feed("\033-Ae�v\016ed\017v\033$(BF|K\\\033(Bfoo")->drain()]], "e�v��v\x65e5\x672c""foo") // Verify that characters mapping to multiple UTF-16 characters work. // ISO-IR 233 aka JIS X0213. -test_eq([[Locale.Charset.decoder("iso-2022")-> +test_eq([[Charset.decoder("iso-2022")-> feed("\e$(Q$w%wy)")->drain()]], "\u304b\u309a\u30ab\u309a\U0002550e") // 2022 variants -test_eq([[Locale.Charset.encoder("iso-2022-jp")-> +test_eq([[Charset.encoder("iso-2022-jp")-> feed("\x30ce\x30f4\x30f8\x30ce")->drain()]], [["\33$B%N%t\33$@%t%N"]]) -test_eq([[Locale.Charset.encoder("iso-2022-cn")-> +test_eq([[Charset.encoder("iso-2022-cn")-> feed("\x5143\x6c14")->drain()]], [["\33$AT*Fx"]]) -test_eq([[Locale.Charset.encoder("iso-2022-jp")-> +test_eq([[Charset.encoder("iso-2022-jp")-> feed("\x5143\x6c17")->drain()]], [["\33$B855$"]]) -test_eq([[Locale.Charset.encoder("iso-2022-kr")-> +test_eq([[Charset.encoder("iso-2022-kr")-> feed("\x5143\x6c23")->drain()]], [["\33$(Cj*Q("]]) -test_eq([[Locale.Charset.encoder("iso-2022-jp2")-> +test_eq([[Charset.encoder("iso-2022-jp2")-> feed("\x9ed8\x9ed5\x9ec9\x9ec3")->drain()]], [["\33$B`T\33$(Dlt\33$AYd\33$(C|\\"]]) -test_eq([[Locale.Charset.encoder("iso-2022")-> +test_eq([[Charset.encoder("iso-2022")-> feed("\x9ed8\x9ed5\x9ec9\x9ec3\xff76\xff85")->drain()]], [["\33$B`T\33$(Dlt\33$AYd\33$(C|\\\33(I6E"]]) -test_eval_error([[Locale.Charset.encoder("iso-2022-jp")-> +test_eval_error([[Charset.encoder("iso-2022-jp")-> feed("\x9ed8\x9ed5\x9ec9\x9ec3")->drain()]]) -test_eval_error([[Locale.Charset.encoder("iso-2022-jp")-> +test_eval_error([[Charset.encoder("iso-2022-jp")-> feed("\xff76\xff85")->drain()]]) -test_eval_error([[Locale.Charset.encoder("iso-2022-jp2")-> +test_eval_error([[Charset.encoder("iso-2022-jp2")-> feed("\xff76\xff85")->drain()]]) test_any([[ // Test encoding (and decoding) of characters from various // different character sets. string vector = "\x1b7\x1f5\x2bf\x2c7\x2c9\x391\x402\x5d0"; - return Locale.Charset.decoder("iso-2022")-> - feed(Locale.Charset.encoder("iso-2022")->feed(vector)->drain())->drain() == + return Charset.decoder("iso-2022")-> + feed(Charset.encoder("iso-2022")->feed(vector)->drain())->drain() == vector; ]], 1) -// Locale.Charset.UTF7 -test_eq([[Locale.Charset.decoder("utf-7")-> +// Charset.UTF7 +test_eq([[Charset.decoder("utf-7")-> feed("foobar+-xy-+--z+AOUA5AD2!+ZeVnLA-X")->drain()]], "foobar+xy-+-z���!\x65e5\x672cX") -// Locale.Charset.UTF8 -test_eq([[Locale.Charset.decoder("utf-8")->feed("åäö")->drain()]],"���") - -test_eq(Locale.Charset.encoder ("utf-8")->feed ("\ud7ff")->drain(), "\u00ed\u009f\u00bf") -test_eval_error(return Locale.Charset.encoder ("utf-8")->feed ("\ud800")->drain()) -test_eval_error(return Locale.Charset.encoder ("utf-8")->feed ("\udfff")->drain()) -test_eq(Locale.Charset.encoder ("utf-8")->feed ("\ue000")->drain(), "\u00ee\u0080\u0080") -test_eq(Locale.Charset.encoder ("utf-8")->feed ("\U0010ffff")->drain(), "\u00f4\u008f\u00bf\u00bf") -test_eval_error(return Locale.Charset.encoder ("utf-8")->feed ("\U00110000")->drain()) - -test_eq(Locale.Charset.decoder ("utf-8")->feed ("\u00ed\u009f\u00bf")->drain(), "\ud7ff") -test_eval_error(return Locale.Charset.decoder ("utf-8")->feed ("\u00ed\u00a0\u0080")->drain()) -test_eval_error(return Locale.Charset.decoder ("utf-8")->feed ("\u00ed\u00bf\u00bf")->drain()) -test_eq(Locale.Charset.decoder ("utf-8")->feed ("\u00ee\u0080\u0080")->drain(), "\ue000") -test_eq(Locale.Charset.decoder ("utf-8")->feed ("\u00f4\u008f\u00bf\u00bf")->drain(), "\U0010ffff") -test_eval_error(return Locale.Charset.decoder ("utf-8")->feed ("\u00f4\u0090\u0080\u0080")->drain()) - -test_eval_error(return Locale.Charset.decoder ("utf-8")->feed ("\xc0\x80")->drain()) -test_eval_error(return Locale.Charset.decoder ("utf-8")->feed ("\xc1\xbf")->drain()) -test_eq(Locale.Charset.decoder ("utf-8")->feed ("\xc2\x80")->drain(), "\x80") -test_eval_error(return Locale.Charset.decoder ("utf-8")->feed ("\xe0\x80\x80")->drain()) -test_eval_error(return Locale.Charset.decoder ("utf-8")->feed ("\xe0\x9f\xbf")->drain()) -test_eq(Locale.Charset.decoder ("utf-8")->feed ("\xe0\xa0\x80")->drain(), "\x800")) -test_eval_error(return Locale.Charset.decoder ("utf-8")->feed ("\xf0\x80\x80\x80")->drain()) -test_eval_error(return Locale.Charset.decoder ("utf-8")->feed ("\xf0\x8f\xbf\xbf")->drain()) -test_eq(Locale.Charset.decoder ("utf-8")->feed ("\xf0\x90\x80\x80")->drain(), "\x10000") -test_eval_error(return Locale.Charset.decoder ("utf-8")->feed ("\xf8")->drain()) -test_eval_error(return Locale.Charset.decoder ("utf-8")->feed ("\xfc")->drain()) -test_eval_error(return Locale.Charset.decoder ("utf-8")->feed ("\xfe")->drain()) -test_eval_error(return Locale.Charset.decoder ("utf-8")->feed ("\xff")->drain()) -test_eval_error(return Locale.Charset.decoder ("utf-8")->feed ("\x80")->drain()) -test_eval_error(return Locale.Charset.decoder ("utf-8")->feed ("\xcf\x3f")->drain()) -test_eval_error(return Locale.Charset.decoder ("utf-8")->feed ("\xcf\x7f")->drain()) -test_eval_error(return Locale.Charset.decoder ("utf-8")->feed ("\xcf\xff")->drain()) - -// Locale.Charset.UTF16 -test_eq([[Locale.Charset.decoder("utf-16")->feed("\0h\0e\0j")->drain()]],"hej") -test_eq([[Locale.Charset.encoder("utf-16")->feed("hej")->drain()]],"\0h\0e\0j") -test_eq([[Locale.Charset.decoder("utf-16BE")->feed("\0h\0e\0j")->drain()]],"hej") -test_eq([[Locale.Charset.encoder("utf-16BE")->feed("hej")->drain()]],"\0h\0e\0j") -test_eq([[Locale.Charset.decoder("utf-16LE")->feed("h\0e\0j\0")->drain()]],"hej") -test_eq([[Locale.Charset.encoder("utf-16LE")->feed("hej")->drain()]],"h\0e\0j\0") +// Charset.UTF8 +test_eq([[Charset.decoder("utf-8")->feed("åäö")->drain()]],"���") + +test_eq(Charset.encoder ("utf-8")->feed ("\ud7ff")->drain(), "\u00ed\u009f\u00bf") +test_eval_error(return Charset.encoder ("utf-8")->feed ("\ud800")->drain()) +test_eval_error(return Charset.encoder ("utf-8")->feed ("\udfff")->drain()) +test_eq(Charset.encoder ("utf-8")->feed ("\ue000")->drain(), "\u00ee\u0080\u0080") +test_eq(Charset.encoder ("utf-8")->feed ("\U0010ffff")->drain(), "\u00f4\u008f\u00bf\u00bf") +test_eval_error(return Charset.encoder ("utf-8")->feed ("\U00110000")->drain()) + +test_eq(Charset.decoder ("utf-8")->feed ("\u00ed\u009f\u00bf")->drain(), "\ud7ff") +test_eval_error(return Charset.decoder ("utf-8")->feed ("\u00ed\u00a0\u0080")->drain()) +test_eval_error(return Charset.decoder ("utf-8")->feed ("\u00ed\u00bf\u00bf")->drain()) +test_eq(Charset.decoder ("utf-8")->feed ("\u00ee\u0080\u0080")->drain(), "\ue000") +test_eq(Charset.decoder ("utf-8")->feed ("\u00f4\u008f\u00bf\u00bf")->drain(), "\U0010ffff") +test_eval_error(return Charset.decoder ("utf-8")->feed ("\u00f4\u0090\u0080\u0080")->drain()) + +test_eval_error(return Charset.decoder ("utf-8")->feed ("\xc0\x80")->drain()) +test_eval_error(return Charset.decoder ("utf-8")->feed ("\xc1\xbf")->drain()) +test_eq(Charset.decoder ("utf-8")->feed ("\xc2\x80")->drain(), "\x80") +test_eval_error(return Charset.decoder ("utf-8")->feed ("\xe0\x80\x80")->drain()) +test_eval_error(return Charset.decoder ("utf-8")->feed ("\xe0\x9f\xbf")->drain()) +test_eq(Charset.decoder ("utf-8")->feed ("\xe0\xa0\x80")->drain(), "\x800")) +test_eval_error(return Charset.decoder ("utf-8")->feed ("\xf0\x80\x80\x80")->drain()) +test_eval_error(return Charset.decoder ("utf-8")->feed ("\xf0\x8f\xbf\xbf")->drain()) +test_eq(Charset.decoder ("utf-8")->feed ("\xf0\x90\x80\x80")->drain(), "\x10000") +test_eval_error(return Charset.decoder ("utf-8")->feed ("\xf8")->drain()) +test_eval_error(return Charset.decoder ("utf-8")->feed ("\xfc")->drain()) +test_eval_error(return Charset.decoder ("utf-8")->feed ("\xfe")->drain()) +test_eval_error(return Charset.decoder ("utf-8")->feed ("\xff")->drain()) +test_eval_error(return Charset.decoder ("utf-8")->feed ("\x80")->drain()) +test_eval_error(return Charset.decoder ("utf-8")->feed ("\xcf\x3f")->drain()) +test_eval_error(return Charset.decoder ("utf-8")->feed ("\xcf\x7f")->drain()) +test_eval_error(return Charset.decoder ("utf-8")->feed ("\xcf\xff")->drain()) + +// Charset.UTF16 +test_eq([[Charset.decoder("utf-16")->feed("\0h\0e\0j")->drain()]],"hej") +test_eq([[Charset.encoder("utf-16")->feed("hej")->drain()]],"\0h\0e\0j") +test_eq([[Charset.decoder("utf-16BE")->feed("\0h\0e\0j")->drain()]],"hej") +test_eq([[Charset.encoder("utf-16BE")->feed("hej")->drain()]],"\0h\0e\0j") +test_eq([[Charset.decoder("utf-16LE")->feed("h\0e\0j\0")->drain()]],"hej") +test_eq([[Charset.encoder("utf-16LE")->feed("hej")->drain()]],"h\0e\0j\0") // Multichar -test_eq([[Locale.Charset.decoder("gbk")->feed("hej\x81\x40")->drain()]],"hej\x4e02") -test_eq([[Locale.Charset.decoder("949")->feed("hej\x81\x41")->drain()]],"hej\xac02") +test_eq([[Charset.decoder("gbk")->feed("hej\x81\x40")->drain()]],"hej\x4e02") +test_eq([[Charset.decoder("949")->feed("hej\x81\x41")->drain()]],"hej\xac02") // GB18030 test_any([[ @@ -149,7 +149,7 @@ test_any([[ // is reset between characters. string ucode = ucodes * ucodes[0]; string bcode = bcodes * bcodes[0]; - string dcode = Locale.Charset.decoder("GB18030")->feed(bcode)->drain(); + string dcode = Charset.decoder("GB18030")->feed(bcode)->drain(); if (dcode != ucode) { string pref = String.common_prefix(({ucode, dcode})); return sprintf("Failure for character U+%06x " @@ -193,7 +193,7 @@ test_any([[ // is reset between characters. string ucode = ucodes * ucodes[0]; string bcode = bcodes * bcodes[0]; - string dcode = Locale.Charset.decoder("GB18030")->feed(bcode)->drain(); + string dcode = Charset.decoder("GB18030")->feed(bcode)->drain(); if (dcode != ucode) { string pref = String.common_prefix(({ucode, dcode})); return sprintf("Failure for character U+%06x (%02x %02x), got U+%06x\n", @@ -243,7 +243,7 @@ test_any([[ // is reset between characters. string ucode = ucodes * ucodes[0]; string bcode = bcodes * bcodes[0]; - string ecode = Locale.Charset.encoder("GB18030")->feed(ucode)->drain(); + string ecode = Charset.encoder("GB18030")->feed(ucode)->drain(); if (ecode != bcode) { string pref = String.common_prefix(({ecode, bcode})); int off = sizeof(pref) & ~3; @@ -288,7 +288,7 @@ test_any([[ // is reset between characters. string ucode = ucodes * ucodes[0]; string bcode = bcodes * bcodes[0]; - string ecode = Locale.Charset.encoder("GB18030")->feed(ucode)->drain(); + string ecode = Charset.encoder("GB18030")->feed(ucode)->drain(); if (ecode != bcode) { string pref = String.common_prefix(({ecode, bcode})); int off = sizeof(pref) & ~1; @@ -301,13 +301,13 @@ test_any([[ ]], 0) // EUC-JP -test_eq([[Locale.Charset.decoder("euc-jp")->feed("\xa1\xd8\x8f\xb0\xa2\x8f\xb0\xa3\xa1\xd9\x8e\xb6\x8e\xc5")->drain()]],"\x300e\x4e04\x4e05\x300f\xff76\xff85") -test_eq([[Locale.Charset.encoder("euc-jp")->feed("\x300e\x4e04\x4e05\x300f\xff76\xff85")->drain()]],"\xa1\xd8\x8f\xb0\xa2\x8f\xb0\xa3\xa1\xd9\x8e\xb6\x8e\xc5") +test_eq([[Charset.decoder("euc-jp")->feed("\xa1\xd8\x8f\xb0\xa2\x8f\xb0\xa3\xa1\xd9\x8e\xb6\x8e\xc5")->drain()]],"\x300e\x4e04\x4e05\x300f\xff76\xff85") +test_eq([[Charset.encoder("euc-jp")->feed("\x300e\x4e04\x4e05\x300f\xff76\xff85")->drain()]],"\xa1\xd8\x8f\xb0\xa2\x8f\xb0\xa3\xa1\xd9\x8e\xb6\x8e\xc5") // Find codecs for all IANA names define(test_codec,[[ - test_true(objectp(Locale.Charset.encoder("$1"))) - test_true(objectp(Locale.Charset.decoder("$1"))) + test_true(objectp(Charset.encoder("$1"))) + test_true(objectp(Charset.decoder("$1"))) dnl When we can compare codecs with equal we could add a test to dnl ensure that we at least have the same codecs in every class. ifelse($#,1,,[[test_codec(shift($*))]]) diff --git a/src/modules/_Stdio/file.c b/src/modules/_Stdio/file.c index b9f84f76ba81a33adfe1e4c0100cf1483a0f497c..174345f65efbb6a74f426688053b982be2e5df12 100644 --- a/src/modules/_Stdio/file.c +++ b/src/modules/_Stdio/file.c @@ -1847,7 +1847,7 @@ static void file__disable_callbacks(INT32 args) *! @note *! Writing of wide strings is not supported. You have to encode the *! data somehow, e.g. with @[string_to_utf8] or with one of the - *! charsets supported by @[Locale.Charset.encoder]. + *! charsets supported by @[Charset.encoder]. *! *! @seealso *! @[read()], @[write_oob()], @[send_fd()] diff --git a/src/testsuite.in b/src/testsuite.in index 1cfaa5e4b31c5b7bb1af75dac68d2d7c7ad008b0..a9fafed7a8ab161dde32263f8194f466a45f450b 100644 --- a/src/testsuite.in +++ b/src/testsuite.in @@ -601,7 +601,7 @@ test_eq([[ // Test case from Robert J. Budzynski <Robert.Budzynski@fuw.edu.pl>. // When broken the return type will be mixed. sprintf("%O", typeof(lambda(string s){ - return Locale.Charset.decoder("utf-8")->feed(s)->drain(); + return Charset.decoder("utf-8")->feed(s)->drain(); })) ]], [[ "function(string : string)" ]]) @@ -2307,7 +2307,7 @@ test_any([[ define(test_backtrace_line_charset, [[ test_any([[ program p=compile_string( -Locale.Charset.encoder("]]$1[[")->feed( +Charset.encoder("]]$1[[")->feed( "#charset ]]$1[[\n" "int foo()\n" "{\n" @@ -9339,7 +9339,7 @@ test_equal([[ test_eq([[cpp("foo _Pragma(\"strict_types \\\\back \\\"str\\\"\") bar")]], "#line 1 \"-\"\nfoo \n#pragma strict_types \\back \"str\"\n#line 1 \"-\"\n bar") test_equal([[ - compile_string(Locale.Charset.encoder("ebcdic-us")-> + compile_string(Charset.encoder("ebcdic-us")-> feed("#charset ebcdic-us\n" "constant val = \"abc\";\n")->drain())()->val; ]], "abc")