Domanda

I am editing my PhP files with Text Edit on my Mac. The PhP files are source code I got from some tutorial. The subtle issue I was able to notice is that the apostrophe ' on the source file is not the same apostrophe I type with my keyboard. Also, when I try to type inside an existing string with the "source apostrophe" I notice the last letter goes outside the string and I am sure this is not a typo from my side.

When I put my keyboard apostrophe in the PhP file I get a 500 internal server error when requesting the PhP file. If I just copy paste a "source apostrophe" I don't get the internal error.

Any idea what is going on here?

EDIT: As funny as it may be, I have put the 3 apostrophe here. The first one is from the source code(most left) the other two are from my keyboard.

' ' `

È stato utile?

Soluzione

I just had a similar problem and discovered it was the Mac text editor automatically substituting Smart Quotes for single quotes. In TextEdit this can be disabled for the current document by unchecking the menu item Edit->Substitutions->Smart Quotes. Or uncheck Smart Quotes in the TextEdit Preferences->New Document->Options for all new documents.

Altri suggerimenti

Ok, I figured this out.

The apostrophe I was getting from my keyboard in Text Edit was UTF 8, it was 3 bytes long. The "good" apostrophe was simply 27 hex. I am now editing my PhP files with xCode instead of Text Edit. I am guessing text edit does some rich text editing? Not sure.

This problem is related to MacOS System.

Solution:

System Preferences -> Keyboard -> Text Tab for singled quotes: 'abc' for doubled quotes: "abcd"

there, you can change the selected value.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top