[swift-users] emoji in source code failed to compile in linux ubuntu

Bee bee.ography at gmail.com
Fri Dec 4 04:56:43 CST 2015


Oh, I'm sorry… I also have conversation with another member of the list,
but we forget to include the list address on the mail target so our
conversation going private.

FYI, I installed swift on my Koding VM (ubuntu 64bit) from koding.com. It
has an online code editor. Their editor still has problem handling unicode.

Hope this will clear all things.

Thank you.



On Fri, Dec 4, 2015 at 5:52 PM, Bee <bee.ography at gmail.com> wrote:

> Here it is:
>
> $ xxd < test.swift
>
> 0000000: 7072 696e 7428 2248 656c 6c6f 2057 6f72  print("Hello Wor
> 0000010: 6c64 2066 726f 6d20 5377 6966 7421 20ed  ld from Swift! .
> 0000020: a0bd edb8 8020 2229                      ..... ")
>
> I've asked Koding dev and they said their editor also has problem handling
> unicode. They believe the problem is with the editor, not swift. They
> suggest to prevent using unicode directly inside the code, and use the
> unicode code instead. So, I think the problem has been cleared, although
> the ideal solution is currently being worked on.
>
> Thank you.
>
>
> On Fri, Dec 4, 2015 at 5:46 PM, Alex Blewitt <alex.blewitt at gmail.com>
> wrote:
>
>> If you run the XXD command it will print out the hex values, which is the
>> important thing (as opposed to a screenshot which doesn’t have that
>> information). For example, it might be using UTF-16 or some other variation.
>>
>> Can you open Terminal and run
>>
>> xxd < test.swift
>>
>> and then copy/paste the text into a mail response? Then we can figure out
>> what’s wrong.
>>
>> Thanks,
>>
>> Alex
>>
>> On 4 Dec 2015, at 11:41, Bee <bee.ography at gmail.com> wrote:
>>
>> Here's the screen capture: http://i.imgur.com/0ud0hE4.png
>>
>>
>> On Fri, Dec 4, 2015 at 1:29 PM, Dmitri Gribenko <gribozavr at gmail.com>
>> wrote:
>>
>>> Hi Bee,
>>>
>>> On Thu, Dec 3, 2015 at 9:00 PM, Bee <bee.ography at gmail.com> wrote:
>>> >
>>> > Hi,
>>> >
>>> > Just successfully installed Swift on my Linux machine. It went well
>>> and a Hello World program compiled successfully. However, when I tried to
>>> put an emoji inside of the string, it failed compiling. The error message
>>> is:
>>> >
>>> > $ swiftc test.swift
>>> > test.swift:1:32: error: invalid UTF-8 found in source file
>>>
>>> This might be a clue... how did you insert the emoji?
>>>
>>> > print("Hello World from Swift! ")
>>> > test.swift:1:35: error: invalid UTF-8 found in source file
>>> > print("Hello World from Swift! ")
>>> > test.swift:1:1: error: 'print' is unavailable: Please wrap your tuple
>>> argument in parentheses: 'print((...
>>> > ))'
>>> > print("Hello World from Swift! ")
>>> > Swift.print:2:13: note: 'print' has been explicitly marked unavailable
>>> here
>>> > public func print<T>(_: T)
>>> >             ^
>>>
>>> Could you post the output of:
>>>
>>> $ xxd < test.swift
>>>
>>> since it looks like mail has mangled the emoji and I'm not seeing it
>>> in your message.
>>>
>>> Dmitri
>>>
>>> --
>>> main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
>>> (j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/
>>>
>>
>>
>>
>> --
>> -Bee-
>>
>>  _______________________________________________
>> swift-users mailing list
>> swift-users at swift.org
>> https://lists.swift.org/mailman/listinfo/swift-users
>>
>>
>>
>
>
> --
> -Bee-
>
>


-- 
-Bee-
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20151204/b830d8a3/attachment.html>


More information about the swift-users mailing list