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

Dmitri Gribenko gribozavr at gmail.com
Fri Dec 4 00:29:37 CST 2015


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>*/


More information about the swift-users mailing list