mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	Use hex-encoded binaries instead of UTF-8
Which UTF-8 char corresponds to the binary representation is nonsense for other encodings, and just confusing.
This commit is contained in:
		
							parent
							
								
									d403591b34
								
							
						
					
					
						commit
						82e836dc7d
					
				
					 1 changed files with 2 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -13,7 +13,7 @@ describe "String#valid_encoding?" do
 | 
			
		|||
  end
 | 
			
		||||
 | 
			
		||||
  it "returns true for all encodings self is valid in" do
 | 
			
		||||
    str = "\u{6754}"
 | 
			
		||||
    str = "\xE6\x9D\x94"
 | 
			
		||||
    str.force_encoding('BINARY').valid_encoding?.should be_true
 | 
			
		||||
    str.force_encoding('UTF-8').valid_encoding?.should be_true
 | 
			
		||||
    str.force_encoding('US-ASCII').valid_encoding?.should be_false
 | 
			
		||||
| 
						 | 
				
			
			@ -102,7 +102,7 @@ describe "String#valid_encoding?" do
 | 
			
		|||
 | 
			
		||||
  ruby_version_is '3.0' do
 | 
			
		||||
    it "returns true for IBM720 encoding self is valid in" do
 | 
			
		||||
      str = "\u{6754}"
 | 
			
		||||
      str = "\xE6\x9D\x94"
 | 
			
		||||
      str.force_encoding('IBM720').valid_encoding?.should be_true
 | 
			
		||||
      str.force_encoding('CP720').valid_encoding?.should be_true
 | 
			
		||||
    end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue