File tree 2 files changed +2
-40
lines changed 2 files changed +2
-40
lines changed Original file line number Diff line number Diff line change @@ -127,26 +127,6 @@ const char * const (pg_enc_pg2ruby_mapping[][2]) = {
127
127
static struct st_table * enc_pg2ruby ;
128
128
129
129
130
- /*
131
- * Look up the JOHAB encoding, creating it as a dummy encoding if it's not
132
- * already defined.
133
- */
134
- static rb_encoding *
135
- pg_find_or_create_johab (void )
136
- {
137
- static const char * const aliases [] = { "JOHAB" , "Windows-1361" , "CP1361" };
138
- int enc_index ;
139
- size_t i ;
140
-
141
- for (i = 0 ; i < sizeof (aliases )/sizeof (aliases [0 ]); ++ i ) {
142
- enc_index = rb_enc_find_index (aliases [i ]);
143
- if (enc_index > 0 ) return rb_enc_from_index (enc_index );
144
- }
145
-
146
- enc_index = rb_define_dummy_encoding (aliases [0 ]);
147
- return rb_enc_from_index (enc_index );
148
- }
149
-
150
130
/*
151
131
* Return the given PostgreSQL encoding ID as an rb_encoding.
152
132
*
@@ -187,10 +167,6 @@ pg_get_pg_encname_as_rb_encoding( const char *pg_encname )
187
167
return rb_enc_find ( pg_enc_pg2ruby_mapping [i ][1 ] );
188
168
}
189
169
190
- /* JOHAB isn't a builtin encoding, so make up a dummy encoding if it's seen */
191
- if ( strncmp (pg_encname , "JOHAB" , 5 ) == 0 )
192
- return pg_find_or_create_johab ();
193
-
194
170
/* Fallthrough to ASCII-8BIT */
195
171
return rb_ascii8bit_encoding ();
196
172
}
Original file line number Diff line number Diff line change 1807
1807
expect ( @conn . internal_encoding ) . to eq ( Encoding ::ASCII_8BIT )
1808
1808
end
1809
1809
1810
- it "the connection should use JOHAB dummy encoding when it's set to JOHAB" do
1810
+ it "the connection should use the BINARY encoding when it's set to JOHAB" do
1811
1811
@conn . set_client_encoding "JOHAB"
1812
1812
val = @conn . exec ( "SELECT chr(x'3391'::int)" ) . values [ 0 ] [ 0 ]
1813
- expect ( val . encoding . name ) . to eq ( "JOHAB" )
1813
+ expect ( val . encoding ) . to eq ( Encoding :: BINARY )
1814
1814
expect ( val . unpack ( "H*" ) [ 0 ] ) . to eq ( "dc65" )
1815
1815
end
1816
1816
1877
1877
expect { @conn . set_client_encoding ( nil ) } . to raise_error ( TypeError )
1878
1878
end
1879
1879
1880
- it "can use an encoding with high index for client encoding" do
1881
- # Allocate a lot of encoding indices, so that MRI's ENCODING_INLINE_MAX is exceeded
1882
- unless Encoding . name_list . include? ( "pgtest-0" )
1883
- 256 . times do |eidx |
1884
- Encoding ::UTF_8 . replicate ( "pgtest-#{ eidx } " )
1885
- end
1886
- end
1887
-
1888
- # Now allocate the JOHAB encoding with an unusual high index
1889
- @conn . set_client_encoding "JOHAB"
1890
- val = @conn . exec ( "SELECT chr(x'3391'::int)" ) . values [ 0 ] [ 0 ]
1891
- expect ( val . encoding . name ) . to eq ( "JOHAB" )
1892
- end
1893
-
1894
1880
end
1895
1881
1896
1882
describe "respect and convert character encoding of input strings" do
You can’t perform that action at this time.
0 commit comments