Converting from unicode to ASCII

Lagi Pittas iphonelagi at gmail.com
Wed Sep 23 07:35:23 EDT 2020


Assuming all the languages are latin type alphabets (no chinese, Japanese ,
Sanskrit ;-) ) (but see later for a fix?)

I would replace the charactes like the E with umlout/cedilla and other
dicritics with the "naked" character  but for others that can't remove them
BUT
add to the end of the filename string the #&999 code from this list
https://en.wikipedia.org/wiki/Cedilla#Similar_diacritics to the end of the
filename.

This would make sure that each filename will be unique if you have a
filename that is close to another. You could even add a number that refers
to the position in the string where that character was.

so instead of #&123 you would put #&5123 which means the character was in
the fifth position. This means that (assuming not chinese) the temporary
file name will give a hint as to the original name
and you could still recreate the original unicode name from the numbers
placed at the end.

It would need a little playing with but I'm sure it could work.

On the chinese (and Sansrit?) question the temporary file name would be
made up of #&123#&321#&435 etc without needing the positional number
alluded to before as all of the original strings would be removed.

It should also work exactly the same way with Bulgarian and again you can
use the numbers (#&123) to recreate the original filename.

Regards Lagi

On Wed, 23 Sep 2020 at 07:11, J. Landman Gay via use-livecode <
use-livecode at lists.runrev.com> wrote:

> On 9/22/20 10:42 PM, Mark Wieder via use-livecode wrote:
> > On 9/22/20 7:58 PM, J. Landman Gay via use-livecode wrote:
> >
> >>> Is this just a temporary filename (not long-term storage)?
> >>
> >> No, the stacks are uploaded to AWS and remain there, retrieved from the
> server on request.
> >> There are currently hundreds of them with more added frequently. That's
> why I'm looking for a
> >> solution that doesn't involve changing all the file names, because
> renaming and re-uploading
> >> all those files would be way too much work.
> >
> > How do the files get retrieved? Is there a database or something similar
> that stores the
> > filenames? You could still use UUID filenames from now on and not have
> to mess with the
> > existing ones.
>
> I may have misled you. When I said the files were permanent, I meant they
> stay on the server
> until they get changed, which is fairly regular. They aren't stored on the
> user's machine where
> tempfile would be, they are downloaded as needed and only kept in memory.
>
> Basically, stacks are named based on a FileMaker database that spits out
> text files listing
> various properties and content that our app needs to know. Stacks are
> created by a tool I wrote
> that merges those text files with a stack template to populate the
> content. The stack name in
> the text file is not only used to create the file name but also appears in
> several other places
> within the stack (menus, popdown buttons, labels, etc.) The file name is
> created by munging the
> name string. I'm looking for a way to create non-unicode file names based
> on the string that
> comes out of the database.
>
> There's more to it than that; the server runs a cron job hourly that
> indexes all its files and
> creates AWS secure URLs for each. The app downloads that lookup file on
> demand. When the user
> selects a name from a list, the selection is munged to match the server
> name and the download
> URL is obtained from the cron job's lookup file.
>
> We don't have a field in the database for a file name. We set up the
> system this way so we
> could change names when needed, which happens whenever the content and
> distribution of the
> material changes. Stacks are updated and replaced, sometimes split into
> two stacks, sometimes
> combined, sometimes rebuilt from scratch. As long as the FM text files
> contain the right
> string, the app can create the server filename. But the file name needs to
> be readily
> identifiable so we can manage the replacements on the server easily. If
> file names were UUIDs,
> wouldn't we still need a way to match the user's selection to a UUID?
>
> When we set this up, we didn't know we were going to go multi-lingual.
>
> --
> Jacqueline Landman Gay         |     jacque at hyperactivesw.com
> HyperActive Software           |     http://www.hyperactivesw.com
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>


-- 
KIndest Regards Lagi



More information about the use-livecode mailing list