-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
linefeed , carriage return should take 2 characters #14
Comments
I'm not sure what the issue is.
Do you have an example message where the length is incorrectly detected? |
hi
i am using your javascript and php code for sms counting in my application
the issues that came up was (elaborate )
1. a user typed a message with line breaks - All English - exactly 160
characters as shown by our script
(Our code counted the line breaks as single count)
2. when this message was transmitted through the provider
The provider takes line breaks as 2 character
3. thus the message was charged for 2 credits insted of 1
i came across a few stack exchange threads where it is mentioned that line
breaks now take 2 instead of 1
my query
can there be a way were we can treat the line breaks as one or two ( as a
choice)
or at the least how do i include those line breaks (10 and 13) into the
javascript and php script
i am not very great at javascript so requested your help
(could not find anything on any forum)
Thanks & Regards
*Rtn.Sareesh Agarwal, PHF.*,
District Information Technology Officer 18-19
Rotary International District 3000
AGASOFT | MyClubOnNet
www.agasoft.co.in | www.MyClubOnNet.com <http://www.myclubonnet.com/>
email: [email protected]
Cell: 90 25 50 50 51
*"Do something for Yourself - It Dies with you !!! *
* Do something for Others - It Lives forever !!!"*
…On Tue, 9 Oct 2018 at 04:23, Danilo R. Gonçalves ***@***.***> wrote:
I'm not sure what the issue is. \n and \r are part of the GSM 7-bit
encoding <https://en.wikipedia.org/wiki/GSM_03.38> and should only use
byte each for strings detected as GSM_7BIT. If you are seeing \n or \r
take up 2 bytes it's either because:
- The message you are testing has characters not supported by GSM_7BIT
or GSM_7BIT_EX, which the library should correctly detect as UTF16.
- Your SMS provider is always using UTF16 encoding, even for cases
where the string is encodable in GSM_7BIT. In this case you might not
need this library since every character will be encoded using 2 bytes
anyway.
Do you have an example message where the length is incorrectly detected?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#14 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AKiKUQ5ryCA6uORCS95huci1xm8PDBpzks5ui9d_gaJpZM4XL2NJ>
.
|
the php script that you have suggested is counting find, 2 chrs for every line break echo SMSCounter::count("This is the first line this show 2 msg count in php, but only 1 msg count via javascript |
OK, I see what the problem is. The lib is correctly counting both The thing is, the content of an HTML textarea will use just My suggestion is to strip |
i found out a way to match the php to the javascript |
You can change \n\r to just \n |
hi
\n and \r should be taking 2 characters, please correct that
on the javascript and teh php version
help on this would be much appriciated
The text was updated successfully, but these errors were encountered: