[SFOS 2.0.1 only] Patch: Character count in SMS editor

Rating: 
5
Your rating: None Average: 5 (7 votes)

No longer maintained after SFOS 2.01. The SMS character counter has been integrated into the Messages app in SFOS 2.0.2, making this patch obsolete.

A patch to show the character count when typing an SMS.

The format is 'x (y)', where y is the number of messages and x is the number of characters left before a new message is started.

The patch applies the next time you start the Messages app.

Note to users

The SMS specification allows 3 types of character encoding, each resulting in a different maximum allowed number of characters per message: 7-bit (160 characters), 8-bit (140 characters) or 16-bit (70 characters).

Some characters (e.g. the tilde '~', pipe '|' or Euro sign '€') require an escape character and are therefore counted as two 7-bit characters. 8-bit characters are used in some special national implementations. Also, the shift table for 7-bit characters is locale specific. See this link for more info.

Known issues

This patch does not recognize the national variations and assumes only the basic shift table for 7-bit characters.

A practical implication may be that some characters are not recognized as belonging to the extended 7-bit set and will be treated as full Unicode characters - i.e., the counter will assume a limit of 70 characters per message rather than 140 or 160. At least it errs on the side of caution.

Character conversion

From version 0.0.3, this patch allows to convert multibyte characters in the message into their 7-bit approximations (e.g. 'ô' to 'o'). The counter changes the colour and becomes touch sensitive. Tap and hold on it and a context menu pops with with the convert option.

This feature is under test and may have some rough edges. For example, it does not convert Cyrillic characters that look similar but sound different (e.g. Cyrillic 'В' is Latin 'V', not 'B', and the patch does not know how to convert it). It also does not convert symbols like 'dz' or 'nj' that are single characters but would need a conversion to character pairs. I have tried my best but I am by no means an expert on character encoding and all my information comes from Wikipedia.

When the patch encounters a character it cannot convert, the conversion stops and the text cursors is set to that character, so the user can substitute it manually.

Please let me know if you find any problems or inconsistencies, including wrongly converted characters, and I will try to fix it in the next update.

Screenshots: 
Application versions: 
AttachmentSizeDate
File jolla-messages-patch-0.0.1-1.noarch.rpm3.79 KB21/10/2015 - 13:50
File jolla-messages-patch-0.0.2-1.noarch.rpm4.96 KB29/10/2015 - 20:38
File jolla-messages-patch-0.0.2-3.noarch.rpm5.21 KB30/10/2015 - 17:35
File jolla-messages-patch-0.0.3-1.noarch.rpm7.37 KB12/11/2015 - 21:43
File jolla-messages-patch-0.0.3-2.noarch.rpm7.51 KB19/01/2016 - 17:54
Changelog: 

0.0.3-2
- Updated dependencies for compatibility with SFOS 2.0.0.x and 2.0.1.x

0.0.3-1
- Added an option to turn multibyte messages into 7-bit
- Efficiency improvements
- Set dependency on a specific version of jolla-messages to force uninstall on system upgrade

0.0.2-3
- Fixed a silly upload issue with Openrepos

0.0.2-2 (removed due to an upload error)
- On popular request, put the clock back and moved the counter to the centre

0.0.2-1
- Fix counter for multibyte characters
- Hide counter when message type is not SMS

0.0.1-1
- First build.

Comments

jolla140917's picture

Sorry to be troublesome for you, I am using version 1.1.2.16 again. I really don't like the os 2.0. The new patch that reduce the remorse timer by ancelad doesn't work on 1.1.2.16. Can you send me your old patch to me? email:286225801@qq.com. thank you!

pichlo's picture

Do you mean the reduce timer patch or this one? I can re-upload the timers patch for SFOS 1.0 but regarding this one, sorry but I can't help. I do not have a device to test it on.

jolla140917's picture

Yea, the times patch. Thank you very much you are able to re-upload the old version patch!

malibu's picture

Hey. Thanks for this patch, usefill trick. But i'm experiencing some laggs when i'm writting a long message.
The keyboard ui became really slow. 

pichlo's picture

You are right, I can definitely reproduce it. The problem is caused by trying to determine the character set (in short, whether you get 160 characters per message or 70). That code is not very efficient and it does jot take too long before you start noticing.

I have some other enhancements planned for the patch, I will look into the ways to improve the character recognition too.

DameCENO's picture

An update! nice work bro, you rock

alina's picture

Thanks, thanks, thanks! A lot! :) It works for me perfectly.

Is it possible to have the clock when SMS is not in use?

Ancelad's picture

Yes. Some my workaround - it shows clock when textfield is empty and characters count when text length is > 0. Also I set update interval to 100 ms - it looks better...

http://paste.ubuntu.com/13007320/

pichlo's picture

I never imagined someone would actually want the clock there but as it seems to be such a popular request, I will post an update "soon" ;-)

alina's picture

I just can't understand the need to replace the clock. I preferred something like this and I made it with adding a separate block for SMS count – without any changes to other default blocks:

This way the counter is near the Send button to see more easily before sending, and also more meaningful near SMS message type.

Edit: I started to work on the files before the latest updates and therefore I didn't see the center alignment. I think the center alignment is good as well.

Nokius's picture

Great!!!! Thanks tell me when you are Berlin I will buy u a drink!

gedeon's picture

You are great! Huge thx!

koshir's picture

You count 2-byte characters as a single character, this is not how it works for SMS...

pichlo's picture

Yes, I know :( That is one known isuue. I mentioned it in the announcement post on TJC. Another known issue is that it always does the count as if for an SMS, even if the message type is MMS or chat.

I will address those in future updates. Ideas on how to tell the encoding would help.

cocovina's picture

Well done!

One of the cool things on which we have been accustomed on the  Symbian (R.I.P.).

DameCENO's picture

I have been looking for this for so long... Thanks a million bro you rock!!!!!!!

Markkyboy's picture

Cool, a nice addition to the SMS app, thanks bud!