{"action":"created","issue":{"url":"https://api.github.com/repos/bwipp/postscriptbarcode/issues/45","labels_url":"https://api.github.com/repos/bwipp/postscriptbarcode/issues/45/labels{/name}","comments_url":"https://api.github.com/repos/bwipp/postscriptbarcode/issues/45/comments","events_url":"https://api.github.com/repos/bwipp/postscriptbarcode/issues/45/events","html_url":"https://github.com/bwipp/postscriptbarcode/issues/45","id":57791671,"number":45,"title":"Error generating some QRCodes (Uppercase issue?) ","user":{"login":"ken-sands","id":9724016,"avatar_url":"https://avatars.githubusercontent.com/u/9724016?v=3","gravatar_id":"","url":"https://api.github.com/users/ken-sands","html_url":"https://github.com/ken-sands","followers_url":"https://api.github.com/users/ken-sands/followers","following_url":"https://api.github.com/users/ken-sands/following{/other_user}","gists_url":"https://api.github.com/users/ken-sands/gists{/gist_id}","starred_url":"https://api.github.com/users/ken-sands/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ken-sands/subscriptions","organizations_url":"https://api.github.com/users/ken-sands/orgs","repos_url":"https://api.github.com/users/ken-sands/repos","events_url":"https://api.github.com/users/ken-sands/events{/privacy}","received_events_url":"https://api.github.com/users/ken-sands/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/bwipp/postscriptbarcode/labels/high-priority","name":"high-priority","color":"fbca04"},{"url":"https://api.github.com/repos/bwipp/postscriptbarcode/labels/unconfirmed","name":"unconfirmed","color":"f7c6c7"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-02-16T11:11:25Z","updated_at":"2015-02-16T15:16:53Z","closed_at":null,"body":"sometimes creating qr codes will throw this error (running through ghostscript)\r\n\r\nUnrecoverable error: typecheck in moveto\r\nOperand stack:\r\n    --nostringval--  10100100111   \r\n\r\nSeems to be when there is a number of uppercase characters, I've not been able to track down the exact cause. however...\r\n\r\nthis works ok\r\n350 -80 moveto (testing) (eclevel=Q) /qrcode /uk.co.terryburton.bwipp findresource exec\r\n\r\nas does this\r\n350 -80 moveto (TEsting) (eclevel=Q) /qrcode /uk.co.terryburton.bwipp findresource exec\r\n\r\nwhile this brings up the error\r\n350 -80 moveto (TESting) (eclevel=Q) /qrcode /uk.co.terryburton.bwipp findresource exec\r\n\r\nAnd this also errors\r\n350 -80 moveto (TESTING) (eclevel=Q) /qrcode /uk.co.terryburton.bwipp findresource exec\r\n\r\n\r\nI'm using the latest version of the qrcode.ps from the repository.\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/bwipp/postscriptbarcode/issues/comments/74522992","html_url":"https://github.com/bwipp/postscriptbarcode/issues/45#issuecomment-74522992","issue_url":"https://api.github.com/repos/bwipp/postscriptbarcode/issues/45","id":74522992,"user":{"login":"terryburton","id":43213,"avatar_url":"https://avatars.githubusercontent.com/u/43213?v=3","gravatar_id":"","url":"https://api.github.com/users/terryburton","html_url":"https://github.com/terryburton","followers_url":"https://api.github.com/users/terryburton/followers","following_url":"https://api.github.com/users/terryburton/following{/other_user}","gists_url":"https://api.github.com/users/terryburton/gists{/gist_id}","starred_url":"https://api.github.com/users/terryburton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/terryburton/subscriptions","organizations_url":"https://api.github.com/users/terryburton/orgs","repos_url":"https://api.github.com/users/terryburton/repos","events_url":"https://api.github.com/users/terryburton/events{/privacy}","received_events_url":"https://api.github.com/users/terryburton/received_events","type":"User","site_admin":false},"created_at":"2015-02-16T15:16:53Z","updated_at":"2015-02-16T15:16:53Z","body":"TL;DR\r\n\r\nChange:\r\n\r\n    350 -180 moveto (TESTING) () /qrcode /uk.co.terryburton.bwipp findresource exec\r\n\r\nTo this:\r\n\r\n    countdictstack array dictstack dup length 3 sub 3 exch getinterval cleardictstack\r\n    350 -180 moveto (TESTING) () /qrcode /uk.co.terryburton.bwipp findresource exec\r\n    {begin} forall\r\n\r\n\r\nLong Version\r\n\r\nThe problem is that your prolog is redefining \"m\" to moveto which is getting immediately bound into the encA (upper-case alphanumeric encoding) procedure which is used only when it is most efficient to do so:\r\n\r\n    /encA {\r\n        /in exch def\r\n        fnc1first {  % FNC1 as %\r\n            /in [ in { dup -1 eq {pop 37} if } forall ] def\r\n        } if\r\n        /out in length 11 mul 2 idiv 1 add string def\r\n        /k 0 def /m 0 def {\r\n            k in length eq {exit} if\r\n            k in length 1 sub lt {\r\n                charvals in k get get 45 mul charvals in k 1 add get get add 11 tobin\r\n                /k k 2 add def\r\n            } {  % Final character\r\n                charvals in k get get 6 tobin\r\n                /k k 1 add def\r\n            } ifelse\r\n            dup out exch m exch putinterval\r\n            length m add /m exch def\r\n        } loop\r\n        out 0 m getinterval    <=== This m is being replaced with \"moveto\" at bind time\r\n    } bind def\r\n\r\nYou could avoid this problem at the cost of a bit of performance by removing the bind at the end of the definition. But a better way is to control the context in which the code is executed by using a wrapper around the invocation as demonstrated above.\r\n\r\nI'll update the documentation with this tip."}}