mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-31 13:50:03 +00:00 
			
		
		
		
	Merge pull request #4668 from wwylele/swkbd-size
applet/swkbd: use UTF-16 string to test string size
This commit is contained in:
		
						commit
						d0de727a97
					
				
					 1 changed files with 5 additions and 3 deletions
				
			
		|  | @ -52,8 +52,10 @@ ValidationError SoftwareKeyboard::ValidateInput(const std::string& input) const | |||
|         return error; | ||||
|     } | ||||
| 
 | ||||
|     // TODO(jroweboy): Is max_text_length inclusive or exclusive?
 | ||||
|     if (input.size() > config.max_text_length) { | ||||
|     // 3DS uses UTF-16 string to test string size
 | ||||
|     std::u16string u16input = Common::UTF8ToUTF16(input); | ||||
| 
 | ||||
|     if (u16input.size() > config.max_text_length) { | ||||
|         return ValidationError::MaxLengthExceeded; | ||||
|     } | ||||
| 
 | ||||
|  | @ -62,7 +64,7 @@ ValidationError SoftwareKeyboard::ValidateInput(const std::string& input) const | |||
|     bool is_empty = input.empty(); | ||||
|     switch (config.accept_mode) { | ||||
|     case AcceptedInput::FixedLength: | ||||
|         if (input.size() != config.max_text_length) { | ||||
|         if (u16input.size() != config.max_text_length) { | ||||
|             return ValidationError::FixedLengthRequired; | ||||
|         } | ||||
|         break; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue