Old 10-06-2019, 04:35 PM   #1
lexaproductions
Human being with feelings
 
Join Date: Jan 2013
Posts: 427
Default Printing French Characters

Hey guys I'm trying to deal with non english characters like "É" "Ç" etc...
I have a print function:
Can somebody tell me why this is working fine:
Code:
  gfx.printf('É')
It prints
Code:
É

and this is not?
Code:
local CurrentProjectFileName = reaper.GetProjectName(0, '') -- pointing to a file that's named 'É'
local CurrentProjectFileNameClean = CurrentProjectFileName:gsub('%.RPP', '')
gfx.printf(CurrentProjectFileNameClean)
It prints
Code:
Somebody can help me???
__________________
MP 12 Core 3.46GHZ 48GB OSX10.11.6, MBP 15" 2012 OSX10.12, RME Fireface UFX, MCU,
Reaper 5, SD2, Omnisphere, Wave Altiverb, PSP, VB3, Izotope, Scuffham, Soundtoys 5, Slate All Plugins.
lexaproductions is offline   Reply With Quote
Old 10-06-2019, 04:43 PM   #2
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 2,768
Default

Is this on macOS (or rather: is the file stored on a HFS+ filesystem)?

Apple's HFS+ filesystem applies Unicode Normalization Form D to every filename. NFD splits letters and their diacritics into different codepoints: É (U+00C9) is split into E (U+0045) and ́ (U+0301). You shouldn't be seeing this behavior on the new APFS filesystem unless the file is created with apps using Apple's higher level libraries (such as Finder) (filenames created on APFS using the command line, Lua and probably REAPER should not be normalized).

https://en.wikipedia.org/wiki/Unicode_equivalence
https://eclecticlight.co/2017/04/06/...ish-languages/ (not sure if up to date, I have never dealt with APFS myself)

It looks like REAPER's gfx string drawing functions don't support NFD/combining characters.

(Also sorry, I didn't have time to look closely at what you sent me earlier yet.)

Last edited by cfillion; 10-07-2019 at 05:22 AM.
cfillion is offline   Reply With Quote
Old 10-06-2019, 05:19 PM   #3
lexaproductions
Human being with feelings
 
Join Date: Jan 2013
Posts: 427
Default

But then is there a function I could make to convert the letters?
__________________
MP 12 Core 3.46GHZ 48GB OSX10.11.6, MBP 15" 2012 OSX10.12, RME Fireface UFX, MCU,
Reaper 5, SD2, Omnisphere, Wave Altiverb, PSP, VB3, Izotope, Scuffham, Soundtoys 5, Slate All Plugins.
lexaproductions is offline   Reply With Quote
Old 10-06-2019, 05:23 PM   #4
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 2,768
Default

A quick Googling gave this Lua code (I haven't tried it and license is unknown): https://github.com/michal-h21/uninor...malization.lua. toNFC_fromNFD sounds like what you need.

But this is probably something that should be handled within REAPER's gfx string functions rather than in individual scripts.

Last edited by cfillion; 10-07-2019 at 05:13 AM.
cfillion is offline   Reply With Quote
Old 10-08-2019, 10:14 PM   #5
lexaproductions
Human being with feelings
 
Join Date: Jan 2013
Posts: 427
Default

I looked it up. It is a bit too involved for me. I'll wait for now...
__________________
MP 12 Core 3.46GHZ 48GB OSX10.11.6, MBP 15" 2012 OSX10.12, RME Fireface UFX, MCU,
Reaper 5, SD2, Omnisphere, Wave Altiverb, PSP, VB3, Izotope, Scuffham, Soundtoys 5, Slate All Plugins.
lexaproductions is offline   Reply With Quote
Reply

Thread Tools
Display Modes

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 -7. The time now is 04:53 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.