Hi, Brent.
Thank you very much for your rapid reply
Hi, Brent.
Thank you very much for your rapid reply
Hi, Brent.
We tested more and tried to find solution. But, unfortunately we cannot found how to solve this issue.
(Including 2013.1256 enterprise and simulator iOS build)
Here’s my code actually using.
There’s no logic clipping, changing of string.
--... --------------------------- -- Read filter words from file local filterChat local path = system.pathForFile( 'etc/filterChat.txt', system.ResourceDirectory ) local fileObject, errStr = io.open( path, 'r' ) path = nil if fileObject == nil then -- no file no filtering filterChat = {} else local filterChatStr = fileObject:read( '\*a' ) -- split into array filterChat = lib.split( filterChatStr, '\n' ) filterChatStr = nil io.close( fileObject ) end -- 5783 words print('filterChat count: '..#filterChat) ------------------------------------- -- Validate input string local function validateChat( str ) if str == nil or str == '' then return false end if string.find(str, '[^%a%d%p%sㄱ-ㅎ가-힣]') ~= nil then -- cannot input character except english, number, korean lib:confirmCheck{ msg='영문, 숫자, 한글 이 외의 문자는 입력할 수 없어요', type='normal' } return false end -- 글자 수 local koreanByteSize = 0 for chr in string.gfind(str, '[ㄱ-ㅎ가-힣]') do koreanByteSize = koreanByteSize + 1 end local normalChar = 0 for word in string.gfind(str, '[%a%d%p%s]') do normalChar = normalChar + 1 end local byteCount = normalChar + (koreanByteSize/3)\*2 if byteCount \> 80 then lib:confirmCheck{ msg='입력 글자는 한글40자, 영문80자를 넘을 수 없어요', type='normal' } return false end -- 금칙어 체크 for i = #filterChat, 1, -1 do -- remove ? character from filter list if str:find( filterChat[i]:gsub('?', '') ) ~= nil then -- there's unallowed word lib:confirmCheck{ msg='금칙어가 포함되어 있습니다.', type='normal' } return false end end return true end --------------------------------------- -- input field self.ui.textField = native.newTextField( 60, 590-26, 650, 53, function(e) if e.phase == "began" then -- user begins editing textField if system.getInfo('platformName') == 'iPhone OS' then e.target.y = 270 end elseif e.phase == "ended" then -- textField/Box loses focus -- Hide keyboard native.setKeyboardFocus( nil ) if system.getInfo('platformName') == 'iPhone OS' then e.target.y = 590 end elseif e.phase == "submitted" then -- Hide keyboard native.setKeyboardFocus( nil ) if system.getInfo('platformName') == 'iPhone OS' then e.target.y = 590 end local inputText = e.target.text -- Validate if not validateChat( inputText ) then return false end -- OK!! SEND!!! M:send{ type='chat', msg=inputText } inputText = nil e.target.text = '' elseif e.phase == "editing" then -- NONE end end) self.ui.textField.align = 'left' self.ui.textField.size = 10 self.ui.textField.font = native.newFont( DEF\_FONT, 10 ) self.ui.textField.y = 590 --...
Hi @zetaloki4,
Do you have a public build or recent daily (non-Enterprise), like #1202 or #1256? If so, could you test out the Corona sample app for text fields? It’s located here:
CoronaSDK > SampleCode > Interface > NativeKeyboard
In my on-device tests using #1256 (again, non-Enterprise), I was able to get Korean characters input into a text field (using the iPhone5’s Korean keyboard), then when I re-opened the text box, the same characters were there… no clipping had occurred. I tested this with several variances of Korean characters, including ending the sentences with a period or a regular character.
So, if you can test this, it may reveal if the issue is related to Enterprise, or something else.
Thanks,
Brent
Hi, Brent.
I checked all.
The problem is textField object’s string value (textField.text). Not displaying.
You can reprise this with “NativeKeyboard” sample project replacing fieldHandler function with code bellow.
You should type the Korean character manually. Copy and paste does not occurs problem.
(Attached result screenshot.)
local function fieldHandler( textField ) local lineCount = 0 return function( event ) if ( "began" == event.phase ) then elseif ( "ended" == event.phase ) then elseif ( "editing" == event.phase ) then elseif ( "submitted" == event.phase ) then -- If you input korean text like 안녕 or 안녕하세요, displaying of text field is ok. -- But, textField().text value would be 안녀ㅇ, 안녕하셍ㅛ that is unexpected result. print( 'Final text value: '..textField().text ) --\> Unexpected result... ----------------- DEBUG: DRAW TEXT ON SCREEN ---------------- local temp = display.newText( textField().text, 0, 270 + lineCount \* 16, nil, 16 ) temp:setTextColor(0,255,0) lineCount = lineCount + 1 ------------------------------------------------------ -- Hide keyboard native.setKeyboardFocus( nil ) end end end
XCODE (iPhone device connected) organizer console outputs like this…
Nov 8 14:47:50 im-utaeg-i NativeKeyboard[11771] <Warning>: Final text value: 안녕하셍ㅛ
Nov 8 14:47:54 im-utaeg-i NativeKeyboard[11771] <Warning>: Final text value: 안녀ㅇ
Best regards.
OSX Mavericks 10.9
Xcode 5.0.2 (5A3005)
Corona SDK: 2013.1257 Standard version (not Enterprise)
Sample Project: NativeKeyboard (without modifications necessary)
I can confirm this behavior on iOS6 and iOS7. When entering the word ‘안녕’, it appears correctly on the display, but outputs the following to the console log on the device:
NativeKeyboard[26488] <Warning>: 안녀ㅇ
However as the OP has observed, if you enter a character after the last ‘ㅇ’ (like a space or a number), the output in the log will be correct (NativeKeyboard[26488] <Warning>: 안녕).
NOTE:
Entering Korean text when running the sample app in the Corona Simulator will crash the simulator.
Hi, Brent.
Would you mind tell me about progression for iOS textfield? or any plan to fix this.
Thank you.
Hi @zetaloki4,
We’re still checking into it; thanks for your patience and your detailed reports (and Ingemar too).
Best regards,
Brent
Hi @zetaloki4,
We have implemented a fix for this, and it should be available to you within the next couple days via a daily build.
Sincerely,
Brent
That sounds great!