Author Topic: FOR DEVELOPER! Characters count method for Unicode character  (Read 20529 times)

sukasem

  • Jr. Member
  • **
  • Posts: 68
FOR DEVELOPER! Characters count method for Unicode character
« on: September 19, 2013, 03:13:30 am »
Hi there,
I just came across this useful method to count strings in Unicode format, useful for foreign languages. Since, ticket template format base on number of characters in each line so, the string length in regular method will result wrong formatting.

Here the solution:
http://stackoverflow.com/questions/12739648/number-of-characters-in-java-string

Hopefully, Emre will implement this in to next release ;)

Cheers,
Sukasem

emre

  • SambaPOS Developer
  • Samba Team
  • Hero Member
  • *****
  • Posts: 1564
Re: FOR DEVELOPER! Characters count method for Unicode character
« Reply #1 on: September 19, 2013, 09:17:21 am »
Can you give more details about your problem? We already have some similar features.

sukasem

  • Jr. Member
  • **
  • Posts: 68
Re: FOR DEVELOPER! Characters count method for Unicode character
« Reply #2 on: September 19, 2013, 07:34:48 pm »
In Thai, some characters is mark as replace so, it won't take up the space because it place on top or bottom of previous character.
I think that post gave very clear picture ;)

In their example, if you count characters regularly it have 7 characters but 2 are placed on top of the previous one (the on that mark as dash circle).

emre

  • SambaPOS Developer
  • Samba Team
  • Hero Member
  • *****
  • Posts: 1564
Re: FOR DEVELOPER! Characters count method for Unicode character
« Reply #3 on: September 20, 2013, 07:11:29 am »
I understand that. Did you see this one before? https://github.com/emreeren/SambaPOS-3/issues/232

sukasem

  • Jr. Member
  • **
  • Posts: 68
Re: FOR DEVELOPER! Characters count method for Unicode character
« Reply #4 on: September 20, 2013, 12:28:43 pm »
Yes I saw it. But I still have this issue with 3.0.27.
I am not sure if you will see this correctly.

░░░░░░░░░░░░░░░ T i c k e t ░░░░░░░░░░░░░░
Date:9/20/2013                           
Time:9:30 AM                             
Table: B12                               
Ticket No:8                               
------------------------------------------
- 1 Toasted Bagel Jam ไม่เอาเห็ด      1.50
- 1 Toasted Bagel Cheese              2.25
==========================================
Total:                                5.51
==========================================
            T H A N K   Y O U             

sukasem

  • Jr. Member
  • **
  • Posts: 68
Re: FOR DEVELOPER! Characters count method for Unicode character
« Reply #5 on: September 20, 2013, 12:39:09 pm »
I've been learning JAVA for the last 2 weeks to manipulate ticket print out to overcome merge lines and use alternative order tag name to get Thai. I try to get all kitchen print out in Thai, item and order tag.
 
That why I came across that code and I do test it and it works.

emre

  • SambaPOS Developer
  • Samba Team
  • Hero Member
  • *****
  • Posts: 1564
Re: FOR DEVELOPER! Characters count method for Unicode character
« Reply #6 on: September 20, 2013, 02:28:09 pm »
I see. How many mark characters you have on ไม่เอาเห็ด word? 2?

sukasem

  • Jr. Member
  • **
  • Posts: 68
Re: FOR DEVELOPER! Characters count method for Unicode character
« Reply #7 on: September 20, 2013, 04:58:56 pm »
Yes, 2 characters should not count.