Raised This Month: $51 Target: $400
 12% 

name[MAX_NAME_LENGTH]


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
emsit
Member
Join Date: Apr 2015
Old 02-24-2018 , 14:46   name[MAX_NAME_LENGTH]
Reply With Quote #1

Hello everyone.

Does it make sense to MAX_NAME_LENGTH be defined at 32?
utf-8 characters use multiple bits. And my plugins crash if the user name contains utf-8 characters...
I give a small example.

output
Test_1: name[MAX_NAME_LENGTH]
strlen: 31, name: '🆃🅴🆂🆃_🅴🅼🆂
Test_2: name[128]
strlen: 37, name: '🆃🅴🆂🆃_🅴🅼🆂🅸🆃'
Test_3: name[MAX_NAME_LENGTH] + remove invalid UTF-8 char
strlen: 29, name: '🆃🅴🆂🆃_🅴🅼🆂'

result
Test_1: Standard use, missing apostroch, plugin crashes
Test_2: ok, no overflow protection.
Test_3: with overflow protection.

what do you think is the best choice to use?
Attached Files
File Type: sp Get Plugin or Get Source (test_4.sp - 804 views - 1.5 KB)
__________________

emsit is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:22.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode