lua-users home
lua-l archive

Re: [Q] handling 0xC2A0 (space in utf8)

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi Peter, thank you for your reply.
My knowledge is limited, and that's why I am probably not understanding
your reply completely.
Here is the editor I am using
http://dojocampus.org/explorer/#Dijit_Editor_Basic
In my 'language' documentation I am just saying that an identifier
must have a space preceding it.
So user can hit the space bar before typing the identifier.
You are saying that a stylesheet can control how the keyboard space
bar is being recorded within textarea of the editor's dom node?
If yes, I will then investigate that (as I have no idea how to
do this in CSS)
On the other hand, I am looking at it -- what if the text was
created by a UTF-8 capable editor, would that editor do exactly
the same thing as the web page: 0xC2A0? and if yes, then
my compiler should support it.
Right now I figured out this in PHP:
$utf8_text=str_replace( chr(0xC2).chr(0xA0),' ',$utf8_text);
- this seems to be working as LUA now can see the 'ascii' space
But I am thinking that there may be things that I am not anticipating,
and that my LPeg grammar to recognize space needs to be 'smarter'.
On 2008年10月16日 15:41:12 -0400, "Peter Harris"
<lua@peter.is-a-geek.org> said:
> On Thu, Oct 16, 2008 at 3:20 PM, V S P wrote:
> > I have spent about 2 days to figure out why certain things do not
> > get recognized by my compiler, and it turns out that it only happens if
> > I put a space preceeding my identifiers in the web page.
> 
> Ah, ha!
> 
> You can't put a (visible) space preceeding anything in HTML. It will
> be dropped by the client. You probably have a broken HTML editor (most
> are) that is inserting &nbsp; (non-breaking space) characters behind
> your back.
> 
> The correct way to adjust visible space is to use CSS. &nbsp; should
> only ever be used to keep a single entity from line breaking.
-- 
 V S P
 toreason@fastmail.fm
-- 
http://www.fastmail.fm - Does exactly what it says on the tin

AltStyle によって変換されたページ (->オリジナル) /