Anybody have some unicode string handling code I could use?

Text handling plugins are not working for some users, since Lua and Lr are not on the same page char-representation-wise.
For example, if you enter
À
in Lightroom, it's getting interpreted as
À
in Lua.
in non-plugin environment, one could just use slnunicode, however in plugin one needs pure lua solution.
Anybody?
ref: http://lua-users.org/wiki/LuaUnicode
R

Try
Debug.pause( "uni-find", string.find( photo:getFormattedMetadata( 'title' ), 'À' ) )
when title field has an 'À' in it.
Instead of seeing the coordinates of the 'À' that is there, you'll see nil.
PS - this code looks promising (?) found at http://forums.gaspowered.com/viewtopic.php?f=19&t=29879
   function conv2utf8(unicode_list)
      local result = ''
      local w,x,y,z = 0,0,0,0
      local function modulo(a, b)
         return a - math.floor(a/b) * b
      end
      for i,v in ipairs(unicode_list) do
         if v ~= 0 and v ~= nil then
            if v <= 0x7F then -- same as ASCII
               result = result .. string.char(v)
            elseif v >= 0x80 and v <= 0x7FF then -- 2 bytes
               y = (v & 0x0007C0) >> 6
               z = v & 0x00003F
               y = math.floor(modulo(v, 0x000800) / 64)
               z = modulo(v, 0x000040)
               result = result .. string.char(0xC0 + y, 0x80 + z)
            elseif (v >= 0x800 and v <= 0xD7FF) or (v >= 0xE000 and v <= 0xFFFF) then -- 3 bytes
               x = (v & 0x00F000) >> 12
               y = (v & 0x000FC0) >> 6
               z = v & 0x00003F
               x = math.floor(modulo(v, 0x010000) / 4096)
               y = math.floor(modulo(v, 0x001000) / 64)
               z = modulo(v, 0x000040)
               result = result .. string.char(0xE0 + x, 0x80 + y, 0x80 + z)
            elseif (v >= 0x10000 and v <= 0x10FFFF) then -- 4 bytes
               w = (v & 0x1C0000) >> 18
               x = (v & 0x03F000) >> 12
               y = (v & 0x000FC0) >> 6
               z = v & 0x00003F
               w = math.floor(modulo(v, 0x200000) / 262144)
               x = math.floor(modulo(v, 0x040000) / 4096)
               y = math.floor(modulo(v, 0x001000) / 64)
               z = modulo(v, 0x000040)
               result = result .. string.char(0xF0 + w, 0x80 + x, 0x80 + y, 0x80 + z)
            end
         end
      end
      return result
   end
or maybe this: (?)
function unichr(ord)
    if ord == nil then return nil end
    if ord < 32 then return string.format('\\x%02x', ord) end
    if ord < 126 then return string.char(ord) end
    if ord < 65539 then return string.format("\\u%04x", ord) end
    if ord < 1114111 then return string.format("\\u%08x", ord) end
end
from http://stackoverflow.com/questions/7780179/what-is-the-way-to-represent-a-unichar-in-lua
R

Similar Messages

  • I have some web pages that loaded completely when using 3G but partially loaded using Wifi.

    I have some web pages that loaded completely when using 3G but partially loaded (only text without any images ) using Wifi. Is it a site specific issue?

    Can you rule out the NoScript extension as a cause of the issues on those sites? Even if you allow the main site to run scripts, often a website will spread its content over additional servers, so you may need to visit the "S" button menu a second or third time to get full functionality. (Over time, you'll recognize some the servers as being for ads, tracking, or sharing buttons and you can just let those parts of the page not work.)

  • Hello friends , I have started with writing  c code on mac using xcode .....but one of my friend told me to use gcc for coding. He started with terminal And used a text editor to compil the c program on his mac.. So please tell me how to do the same

    Hello friends , I have started with writing  c code on mac using xcode .....but one of my friend told me to use gcc for coding. He started with terminal And used a text editor to compil the c program on his mac.. So please tell me how to do the same and is there any pre stalled text editor on mac if yes then where and if no then which text editor to install and how to install gcc...please help me out thanks in advance !!!

    I have started with writing  c code on mac using xcode .....but one of my friend told me to use gcc for coding.
    Why? If you are developing and writing code on a Mac why would you not use the tools Apple has given you? And Xcode, once you get use to it, is a very nice development environment that will make you life a whole lot easier.
    If you insist on using an editor and the terminal I would recommend  Emacs   but it has a long learning curve so  something like TextWrangler  will work too.
    As for the compiler if you have Xcode installed install the command line tools and you will be able to compile from the terminal.
    good luck

  • Do we have some way to reduce Dimension table size using NLS?

      Initially we thought the Cube
         archive in NLS would be like:
    Replicate Cube in NLS with DAP.  DAP creation will create a new structure same like "Star Schema".
    While we load data to NLS it deletes from DB.
    And hence it reduced size of the DB.
    Associated Dimensions will also be replicated in the NLS.
    After actually implementation we found :
    Fact table size is reducing and DB size with associated E/F fact table is reducing
    Dimension tables are still there in DB, and still saving space in DB.
    Do we have some other way to reduce Dimension table size using NLS?
    As when we are analyzing top 100 tables in SAP BW, we are seeing multiple dimensions are part
    of this list.
    Thanks,
    Jaydip

    Hi Jaydip,
    Please check below link it might be helpful for you.
    http://www.informatik.uni-jena.de/dbis/lehre/ss2011/dbarch/SAP_BW_DB2_NLS_22062011.pdf

  • Like many others, I`m a business man and in many ocasions I need to access xls files (Excel) but being able to change using macros like in simulators. I think apple should provide this in the iphone or maybe have some sort of app which we can use?

    I am a business man, and in many times a need a very important tool which I think an iphone should have which is some sort of app which will allow you to make changes to any xls file(Excel file).
    I find apps that allow me to see and open these files but do not allow changing numbers on files with Macros.
    A example is when you have a xls file using macros like in a simulator.
    You have to change the values according to different client and it just doesn`t allow you.
    I think iphone is a very decent phone but I just think that apple should povide this option to all users which would definately be alot happier.
    I work at a finance company and need to use finance simulators with Macros.
    Can you have an app that allows me to do this?

    Since Excel is a microsoft product, they would have to make the app.
    "So why does apple even open these files when they belong to Microsoft?"
    You prefer, since Apple does not make excel, that they not make it possible to even view an excel file?
    Odd take.  All or nothing?

  • I seem to have some kind of virus. When I use the internet a pop up consistently comes up when I click any link, and on Facebook I get new ads put next to people's photos.

    I need to know how to remove this virus for free.

    Please post a screenshot that shows what you mean. Be careful not to include any private information.
    Start a reply to this message. Click the camera icon in the toolbar of the editing window and select the image file to upload it. You can also include text in the reply.

  • How to use Unicode strings for tool titles?

    So one of the few remaining Illustrator suites that does not accept ai::UnicodeString objects for arguments is AIToolSuite. I would really (really!) like to get some Unicode characters in some of my tool titles and tips, but figuring out what goes on behind the sAITool->AddTool() call, with its char* arguments, is tough.
    I have tried the obvious stuff, like passing UTF-8 multibyte data, which doesn't work. I have tried more nebulous approaches, like passing Z-string data with Adobe's strange way of "escaping" Unicode code points (they typically use "^U+1234" instead of the de facto "\u1234"), which doesn't work either.
    The result is that Unicode data either doesn't show at all, or shows as the typical Latin-based garbage full of diacritical marks (e.g. "éáÊöãÀ") which is nowhere near the original data that was passed in.
    Anybody have some insight?
    PS: I plan on filing a feature request shortly for ai::UnicodeString support in AIToolSuite, but until then...
    Thanks,
    - Garrett

    Hello Mark -
    At this time TestStand has no unicode support. The multi-byte support that we do offer is based on the Windows architecture that handles Asian language fonts. It really isn't meant to provide a bridge for unicode values in TestStand. Certainly, your Operator Interface environment will have its own support level for unicode, i.e. at this time neither LabWindows/CVI version 6.0 nor LabVIEW 6.1 officially support unicode characters. This is why you will see that the units defined in the TestStand enumerators are all text-based values.
    I have run a quick test here, probably similar to what you were doing on your end, and I am uncertain if you will get the database behavior you want from TestStand. The database logging steps and API all use basic char sty
    le strings to communicate to the driver. Even though you are reading in a good value from Excel, TestStand is interpreting the character as the nearest ASCII equivalent, i.e. "Ω" will be stored and sent to the database as "O". If you have a stored proceedure in Oracle that is calling on some TestStand variable or property string as an input, then it is doubtful you will get correct transmission of the values to the database. If your stored proceedure could call into a spreadsheet directly, you would probably have better luck.
    Regards,
    Elaine R.
    National Instruments
    http://www.ni.com/ask

  • Why "You do not have authorization to display company codes" ? Thanks

    Hello,
    Using the Tutorial BAPI which comes with the JCO Tutorial,I just wanna call the first function.
    When I run the code, it display "You do not have authorization to display company codes".
    Could any body please help me to explain why?
    Thanks a lot
    BELOW IS THE CODE:
    package com.sap.slc.teamweb.test;
    import com.sap.mw.jco.*;
    public class TestBapi1 extends Object {
        JCO.Client mConnection;
        JCO.Repository mRepository;
        public TestBapi1() {
            try {
                // Change the logon information to your own system/user
                JCO.createClient("001", // SAP client
                  "<userid>", // userid
                  "****", // password
                  null, // language
                  "<hostname>", // application server host name
                  "00"); // system number
                mConnection.connect();
                mRepository = new JCO.Repository("SAPJCO", mConnection);
            } catch (Exception ex) {
                ex.printStackTrace();
                System.exit(1);
            JCO.Function function = null;
            JCO.Table codes = null;
            try {
                function = this.createFunction("BAPI_COMPANYCODE_GETLIST");
                if (function == null) {
                    System.out.println("BAPI_COMPANYCODE_GETLIST" + " not found in SAP.");
                    System.exit(1);
                mConnection.execute(function);
                JCO.Structure returnStructure = function.getExportParameterList().getStructure("RETURN");
                if (!(returnStructure.getString("TYPE").equals("") || returnStructure.getString("TYPE").equals("S"))) {
                    System.out.println(returnStructure.getString("MESSAGE"));
                    System.exit(1);
                codes = function.getTableParameterList().getTable("COMPANYCODE_LIST");
                for (int i = 0; i < codes.getNumRows(); i++) {
                    codes.setRow(i);
                    System.out.println(codes.getString("COMP_CODE") + '\t' + codes.getString("COMP_NAME"));
            catch (Exception ex) {
                ex.printStackTrace();
                System.exit(1);
            try {
                codes.firstRow();
                for (int i = 0; i < codes.getNumRows(); i++, codes.nextRow()) {
                    function = this.createFunction("BAPI_COMPANYCODE_GETDETAIL");
                    if (function == null) {
                        System.out.println("BAPI_COMPANYCODE_GETDETAIL" + " not found in SAP.");
                        System.exit(1);
                    function.getImportParameterList().
                    setValue(codes.getString("COMP_CODE"), "COMPANYCODEID");
                    function.getExportParameterList().
                    setActive(false, "COMPANYCODE_ADDRESS");
                    mConnection.execute(function);
                    JCO.Structure returnStructure = function.getExportParameterList().getStructure("RETURN");
                    if (!(returnStructure.getString("TYPE").equals("") ||
                    returnStructure.getString("TYPE").equals("S") ||
                    returnStructure.getString("TYPE").equals("W"))) {
                        System.out.println(returnStructure.getString("MESSAGE"));
                    JCO.Structure detail =
                    function.getExportParameterList().
                    getStructure("COMPANYCODE_DETAIL");
                    System.out.println(detail.getString("COMP_CODE") + '\t' +
                    detail.getString("COUNTRY") + '\t' +
                    detail.getString("CITY"));
            catch (Exception ex) {
                ex.printStackTrace();
                System.exit(1);
            mConnection.disconnect();
        public JCO.Function createFunction(String name) throws Exception {
            try {
                IFunctionTemplate ft = mRepository.getFunctionTemplate(name.toUpperCase());
                if (ft == null)
                    return null;
                return ft.getFunction();
            catch (Exception ex) {
                throw new Exception("Problem retrieving JCO.Function object.");
        public static void main(String args[]) {
            TestBapi1 app = new TestBapi1();

    Hi Mao,
    R/3 comes with some predefined Company Codes and we also
    can define our own Company Codes.
    visit this link this may help you.
    http://help.sap.com/saphelp_erp2004/helpdata/en/8e/1a5217171311d28e1d080009b6ab29/frameset.htm
    Regards,
    Narinder Hartala

  • HT1349 I don't have an Apple product. I accidentally signed up for iCloud because I thought I could use it with my iTunes on my PC. Now it won't go away. I have deleted the software but every time I open iTunes it demands I reopen my iCloud session. Help.

    I want to get rid of iCloud. I do not currently have an Apple product but thought I could use it with iTunes and my PC. I have deleted the software. I told iTunes to take it off my account, but every time I open iTunes there it is again, asking me to log into iCloud. I can't get Apple support because I don't have an Apple product. I don't know how to get rid of this!

    This is for a Mac, but may be similar for a PC.
    How-to: Safely delete an iCloud account from your Mac or iOS device
    http://9to5mac.com/2013/07/13/how-to-safely-delete-an-icloud-account-from-your-m ac-or-ios-device/
     Cheers, Tom

  • Problem with web service that returns an object with a String that have som

    Hi everybody:
    I have a problem with a web service I am doing, I have made a web service that returns a collection of objects, the objects have a set of properties, there is one property that is a String,this property consists in a text fragment that could have some characters that are considered special in XML like &, <, >, " and that's why when I execute the service from a client an exception is thrown:
    {code}
    Exception in thread "main" org.codehaus.xfire.XFireRuntimeException: Could not invoke service.. Nested exception is org.codehaus.xfire.fault.XFireFault: Could not read XML stream.. Nested exception is com.ctc.wstx.exc.WstxParsingException: Expected a text token, got START_ELEMENT.
    at [row,col {unknown-source}]: [9,646]
    org.codehaus.xfire.fault.XFireFault: Could not read XML stream.. Nested exception is com.ctc.wstx.exc.WstxParsingException: Expected a text token, got START_ELEMENT.
    at [row,col {unknown-source}]: [9,646]
    at org.codehaus.xfire.fault.XFireFault.createFault(XFireFault.java:89)
    at org.codehaus.xfire.client.Client.onReceive(Client.java:410)
    at org.codehaus.xfire.transport.http.HttpChannel.sendViaClient(HttpChannel.java:139)
    at org.codehaus.xfire.transport.http.HttpChannel.send(HttpChannel.java:48)
    at org.codehaus.xfire.handler.OutMessageSender.invoke(OutMessageSender.java:26)
    at org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)
    at org.codehaus.xfire.client.Invocation.invoke(Invocation.java:79)
    at org.codehaus.xfire.client.Invocation.invoke(Invocation.java:114)
    at org.codehaus.xfire.client.Client.invoke(Client.java:336)
    at org.codehaus.xfire.client.XFireProxy.handleRequest(XFireProxy.java:77)
    at org.codehaus.xfire.client.XFireProxy.invoke(XFireProxy.java:57)
    at $Proxy0.search(Unknown Source)
    at cu.co.cenatav.webservices.client.Client.main(Client.java:26)
    {code}
    I know that this is happening because special characters are sent by the soap message but I don't know how to solve this problem.
    How could I avoid this exception ?
    I hope you can help me.
    Regards.
    Ariel

    Hi,
    BPEL and BPEL PM do not have a good support for SOAPENC-Array: it would be very difficult to create such an array in BPEL or to receive it and manipulate it.
    The (unfortunately very intrusive) work around is to change the WSDL of the service to use a XML type defined using XML schema. This is all the more painful that JDev 9.0.4 does not have strong support for complex types.
    In general though, I would highly recommend this best practice:
    1) Start by define the WSDL contract first
    2) Then generate the server side skeleton to implement it
    3) Use BPEL as the client to this contract.
    By starting with the contract first, you make sure that 1) your interfaces are clean and coarse grained.
    2) things like java objects, sessions, etc to not leak through the interface (which would be the worst thing that could happen because it would closely link the client and the server.
    Sorry for not being more helpful. This will get radically cleaner in Oracle AS 10.1.3.
    Edwin

  • I just received a new macbook pro. I am looking for a usb3 external storage 500 GB drive.  Some manufacturers of drives aren't for sure their drive will work with the new lion system. Does anybody have any suggestions for drives that will workw

    I just received a new macbook pro. I am looking for a usb3 external storage 500 GB drive.  Some manufacturers of drives aren't for sure their drive will work with the new  system. Does anybody have any suggestions for drives that will workw

    There seems to be a problem, just now, with the USB 3 ports on the new MBP's supporting eternal USB 3 drives. Some people have no luck at all - can't even recognize the drive - and some are reporting USB 2 speeds (those who drives are recognized). I'd call a dealer such as LaCie or OWC to see if they have USB 3 drives that actually work with MBP's with USB 3 ports. You may have to wait for a software/firmware update.
    Clinton

  • Error synchroniz​ing with Windows 7 Contacts: "CRADSData​base ERROR (5211): There is an error converting Unicode string to or from code page string"

    CRADSDatabase ERROR (5211): There is an error converting Unicode string to or from code page string
    Device          Blackberry Z10
    Sw release  10.2.1.2977
    OS Version  10.2.1.3247
    The problem is known by Blackberry but they didn't make a little effort to solve this problem and they wonder why nobody buy Blackberry. I come from Android platform and I regret buying Blackberry: call problems(I sent it to service because the people that I was talking with couldn't hear me), jack problems (the headphones does not work; I will send it again to service). This synchronisation problem is "the drop that fills the glass". Please don't buy Blackberry any more.
    http://btsc.webapps.blackberry.com/btsc/viewdocume​nt.do?noCount=true&externalId=KB33098&sliceId=2&di​...

    This is a Windows registry issue, if you search the Web using these keywords:
    "how to fix craddatabase error 5211"       you will find a registry editor that syas it can fix this issue.

  • Is anybody else still not able to use the App Store? I can't download nor update any apps. I have an IPhone 5 device not currently updated to iOS 7 as my partner also has an iPhone 5 running iOS 7 and it seems to have some issues at the moment.

    Is anybody else still not able to use the App Store? I can't download nor update any apps. I have an IPhone 5 device not currently updated to iOS 7 as my partner also has an iPhone 5 running iOS 7 and it seems to have some issues at the moment.

    Hi Tech5Apple,
    Thanks for visiting Apple Support Communities.
    If you continue to see unexpected behavior when accessing the iTunes Store, the troubleshooting steps in this article can help:
    Can't connect to the iTunes Store
    http://support.apple.com/kb/ts1368
    All the best,
    Jeremy

  • I've a problem which is: Ibelieve there's someone who knows my password in some games like "Happy Day" so, could you please help me by not letting anybody to use this game except for this IMEI 01 336000 521261 1 even if they have the correct password.

    I've a problem which is: Ibelieve there's someone who knows my password in some games like "Happy Day" so, could you please help me by not letting anybody to use this game except for this IMEI 01 336000 521261 1 even if they have the correct password. Thanks alot for your help.

    Change your password.
    These are user forums. We can't do what you ask, in fact no one can.

  • I have imported some studio footage to my timeline and when i play it back the playback screen is green, even the footage in the timeline is green. anybody have a solution? thanks!

    I have imported some studio footage to my timeline and when i play it back the playback screen is green, even the footage in the timeline is green. anybody have a solution? thanks!

    Exactly WHAT did you import?
    Exactly what is INSIDE the video you are editing?
    Codec & Format information, with 2 links inside for you to read http://forums.adobe.com/thread/1270588
    Report back with the codec details of your file, use the programs below... A screen shot works well to SHOW people what you are doing
    https://forums.adobe.com/thread/1070933 for screen shot instructions
    Free programs to get file information for PC/Mac http://mediaarea.net/en/MediaInfo/Download
    More information needed for someone to help... please click below and provide the requested information
    -Premiere Pro Video Editing Information FAQ http://forums.adobe.com/message/4200840
    •What is your exact brand/model graphics adapter (ATI or nVidia or ???)
    •What is your exact graphics adapter driver version?
    •Have you gone to the vendor web site to check for a newer driver?
    •For Windows, do NOT rely on Windows Update to have current driver information
    •-you need to go direct to the vendor web site and check updates for yourself
    •ATI Driver Autodetect http://support.amd.com/en-us/download/auto-detect-tool
    •nVidia Driver Downloads http://www.nvidia.com/Download/index.aspx?lang=en-us

Maybe you are looking for

  • Itunes won't open due to quicktime problem

    hi i have recently moved my itunes library from my old computer to a new laptop. the promblem is, when i tried to open itunes, it said there were files missing so i uninstalled it and the reinstalled it. but then it said, check that my quicktime was

  • Can't log in to iTunes on my Apple TV/iTunes Store is unavailable

    I can't seem to login to iTunes from my Apple TV... I already have an iTunes account. Keeps telling me that my account name is not found or my password is incorrect. Also, can't get on to the store either. Says it's unavailable. Are these two issues

  • Trouble with back to my mac in hotels?

    I've got several Macs that are are connected via iCloud and back to my mac for screen sharing. I've noticed that while traveling I cannot "see" the other Macs and am wondering if some hotel wifi's close out these connections. I can easily see all the

  • Orange-Red Blotches in Aperture, yet not in Preview....

    In Aperture the photo looks like it has Orange/Red blotches in it... BUT, when opened in preview or iPhoto, it looks ok???? I shot it with a nikon D50 it is a raw file... Help, any ideas.... take a look here.. http://web.mac.com/careyjames/iWeb/Carey

  • Restore standby database 10gR2 after crash

    The RMAN do a full backup of the physical standby of the DataGuard 10gR2 everyday. If the standby was dead, disks corrupted, and replaced with a new server. Can we restore the standby from the RMAN backup, apply the archivelogs or we have re-create t