|
150 | 150 | } |
151 | 151 | end |
152 | 152 |
|
153 | | - it 'Read/Write Blob Block Content UTF-8' do |
| 153 | + it 'Read/Write Blob Block Content UTF-8 with auto charset' do |
154 | 154 | GB18030TestStrings.get.each { |k,v| |
155 | 155 | blob_name = 'Read/Write Block Blob Content UTF-8 for ' + k |
156 | 156 | content = v.encode('UTF-8') |
157 | | - |
158 | 157 | subject.create_block_blob container_name, blob_name, content |
159 | 158 | blob, returned_content = subject.get_blob container_name, blob_name |
160 | | - |
161 | 159 | returned_content.must_equal content |
162 | 160 | } |
163 | 161 | end |
164 | 162 |
|
165 | | - it 'Read/Write Blob Block Content GB18030' do |
| 163 | + it 'Read/Write Blob Block Content GB18030 with explicit charset' do |
166 | 164 | GB18030TestStrings.get.each { |k,v| |
167 | 165 | blob_name = 'Read/Write Block Blob Content GB18030 for ' + k |
168 | 166 | content = v.encode('GB18030') |
169 | | - options = { :content_encoding=> 'GB18030'} |
| 167 | + options = { :content_type => 'text/html; charset=GB18030' } |
170 | 168 | subject.create_block_blob container_name, blob_name, content, options |
171 | 169 | blob, returned_content = subject.get_blob container_name, blob_name |
172 | | - returned_content.force_encoding(blob.properties[:content_encoding]) |
| 170 | + charset = blob.properties[:content_type][blob.properties[:content_type].index('charset=') + 'charset='.length...blob.properties[:content_type].length] |
| 171 | + returned_content.force_encoding(charset) |
173 | 172 | returned_content.must_equal content |
174 | 173 | } |
175 | 174 | end |
176 | 175 |
|
177 | | - it 'Read/Write Blob Page Content UTF-8' do |
| 176 | + it 'Read/Write Blob Page Content UTF-8 with explicit charset' do |
178 | 177 | GB18030TestStrings.get.each { |k,v| |
179 | 178 | blob_name = 'Read/Write Page Blob Content UTF-8 for ' + k |
180 | | - options = { :content_encoding=> 'UTF-8'} |
| 179 | + options = { :content_type => 'text/html; charset=UTF-8' } |
181 | 180 | content = v.encode('UTF-8') |
182 | 181 | while content.bytesize < 512 do |
183 | 182 | content << 'X' |
184 | 183 | end |
185 | 184 | subject.create_page_blob container_name, blob_name, 512, options |
186 | 185 | subject.put_blob_pages container_name, blob_name, 0, 511, content |
187 | 186 | blob, returned_content = subject.get_blob container_name, blob_name |
188 | | - returned_content.force_encoding(blob.properties[:content_encoding]) |
| 187 | + charset = blob.properties[:content_type][blob.properties[:content_type].index('charset=') + 'charset='.length...blob.properties[:content_type].length] |
| 188 | + returned_content.force_encoding(charset) |
189 | 189 | returned_content.must_equal content |
190 | 190 | } |
191 | 191 | end |
192 | 192 |
|
193 | | - it 'Read/Write Blob Page Content GB18030' do |
| 193 | + it 'Read/Write Blob Page Content GB18030 with explicit charset' do |
194 | 194 | GB18030TestStrings.get.each { |k,v| |
195 | 195 | blob_name = 'Read/Write Page Blob Content GB18030 for ' + k |
196 | | - options = { :content_encoding=> 'GB18030'} |
| 196 | + options = { :content_type => 'text/html; charset=GB18030' } |
197 | 197 | content = v.encode('GB18030') |
198 | 198 | while content.bytesize < 512 do |
199 | 199 | content << 'X' |
200 | 200 | end |
201 | 201 | subject.create_page_blob container_name, blob_name, 512, options |
202 | 202 | subject.put_blob_pages container_name, blob_name, 0, 511, content |
203 | 203 | blob, returned_content = subject.get_blob container_name, blob_name |
204 | | - returned_content.force_encoding(blob.properties[:content_encoding]) |
| 204 | + charset = blob.properties[:content_type][blob.properties[:content_type].index('charset=') + 'charset='.length...blob.properties[:content_type].length] |
| 205 | + returned_content.force_encoding(charset) |
205 | 206 | returned_content.must_equal content |
206 | 207 | } |
207 | 208 | end |
|
0 commit comments