Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Devices

Notices

Reply
 
Thread Tools Search this Thread
Old 09-04-2021, 11:53 PM   #1
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 8,848
Karma: 62032373
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Plugboard: Removing Unicode characters that Kobo can't render

I have this plugboard for "series" in KOBOTOUCHEXTENDED:

Code:
{series:'re_group($,"([^.]+)\.","[[$]]: ")'}
I forgot exactly why I'm using the re_group.

Anyways, I have a fanfic that has some fancy unicode characters for some effect:

Click image for larger version

Name:	2021-09-05 00_48_29-Window.png
Views:	148
Size:	1,012 Bytes
ID:	189116

This is how it appears on the Kobo:

Click image for larger version

Name:	20210905_004501.jpg
Views:	150
Size:	36.7 KB
ID:	189117

I'm guessing there's no real way for the Kobo to deal with this, so is there anything I can do on Calibre side without changing the series? Is there a way to strip out the Unicode without leaving behind the dash and I?


Last edited by ownedbycats; 09-05-2021 at 03:30 PM.
ownedbycats is offline   Reply With Quote
Old 09-05-2021, 05:02 AM   #2
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,791
Karma: 7029971
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Could you give us the actual source string, not an image of it? And could you give us what you want as the destination string?

A brute force solution would be to use a plugboard that looks for offending series names and returns the desired series name. This isn't too painful if you don't have many of them.

EDIT: I wonder what the 'transliterate' formatter function would do with your string ...

Last edited by chaley; 09-05-2021 at 05:10 AM.
chaley is offline   Reply With Quote
Advert
Old 09-05-2021, 03:29 PM   #3
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 8,848
Karma: 62032373
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Assuming it posts correctly on the forum, the characters are ᕼ ᗩ ᒪ ᖴ - ᒪ I ᖴ ᗴ.
ownedbycats is offline   Reply With Quote
Old 09-05-2021, 03:33 PM   #4
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,791
Karma: 7029971
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Well, 'transliterate' doesn't do anything useful. For the string ''ᕼ ᗩ ᒪ ᖴ - ᒪ I ᖴ ᗴ'' it returns 'h po ma we - ma I we ga'.
chaley is offline   Reply With Quote
Old 09-05-2021, 03:40 PM   #5
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,791
Karma: 7029971
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
A example plugboard template that returns what I think you want follows. It returns a special string if the series matches some value, otherwise it returns the series. If the series is empty it returns the empty string.
Code:
program:
	s = $series;
#	s = 'ᕼ ᗩ ᒪ ᖴ - ᒪ I ᖴ ᗴ';
	first_non_empty(
		if s == 'ᕼ ᗩ ᒪ ᖴ - ᒪ I ᖴ ᗴ' then 'Half-life' fi,
# 		add more lines here if needed
		s
	)
chaley is offline   Reply With Quote
Advert
Old 09-05-2021, 04:09 PM   #6
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,120
Karma: 1954138
Join Date: Aug 2015
Device: Kindle
You can also use user defined template functions to do one of two things:
  1. Remove non unicode characters as you requested:
    Code:
    def evaluate(self, formatter, kwargs, mi, locals, val):
    	string_encode = val.encode("ascii", "ignore")
    	string_decode = string_encode.decode()
    	return string_decode
    you can use the new function like this:

    Code:
    program:
    	s = 'ᕼ ᗩ ᒪ ᖴ - ᒪ I ᖴ ᗴ';
    	remove_unicode_characters(s)
  2. Make lookup replacement for unicode characters:
    Code:
    def evaluate(self, formatter, kwargs, mi, locals, val):
    	lookup = {
    	    'ᕼ': 'H',
    	    'ᗩ': 'A',
    	    'ᒪ': 'L',
    	    'ᖴ': 'F',
    	    'ᗴ': 'E'
    	}
    	new_string = ''
    	for ch in val:
    	    new_string += lookup.get(ch, ch)
    	return new_string
    You need to expand the lookup dictionary (highlighted in blue) to include any additional unicode characters you want.

    You can use this new function as follows

    Code:
    program:
    	s = 'ᕼ ᗩ ᒪ ᖴ - ᒪ I ᖴ ᗴ';
    	unicode_lookup(s)

Notes
  • To add the new functions described above: preferences > template functions > template functions tab > copy-paste in the program code box and enter the name of the function (highlighted above in green) in the function box.
  • For both functions the argument count should be set to 1.

Last edited by capink; 09-05-2021 at 04:16 PM.
capink is offline   Reply With Quote
Old 09-11-2021, 01:03 AM   #7
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 8,848
Karma: 62032373
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Thanks
ownedbycats is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
find unicode characters Sunlite Editor 12 01-05-2014 07:04 AM
Support of Special Unicode Characters? gawl ePub 6 03-27-2013 02:41 PM
ePub CSS @fontface Unicode chars render in <td>, not in <div>, other elements Abelinkin ePub 2 06-05-2012 04:24 AM
¿Convert unicode decomposed characters to unique/normal characters? JohnQwerty Calibre 3 04-05-2012 12:08 PM
Non-Roman Unicode Characters teh603 Writers' Corner 7 03-26-2012 11:06 AM


All times are GMT -4. The time now is 02:14 PM.


MobileRead.com is a privately owned, operated and funded community.